Bug 1421197 - use 64-bit for restyle generation counters to avoid overflow issues. r=heycam

It is expected to use 64-bit for all the restyle generation counters, since the
getter methods all return uint64_t type at present. However, we're using uint32_t
for the actual counter variables, which means the potential overflow issue is not
avoided.

In this patch, we use 64-bit for the restyle generation counters, so the overflow
issue can be avoided as expected.

MozReview-Commit-ID: 2y2afIcuwvc

--HG--
extra : rebase_source : 3fe64d7d3fc00fa1031eef9f0c15b64405435dfd
This commit is contained in:
Jeremy Chen 2017-11-28 17:42:22 +08:00
parent 4b66d38dd6
commit d4489c8a64

View File

@ -38,12 +38,12 @@ public:
// Get an integer that increments every time we process pending restyles.
// The value is never 0.
uint32_t GetRestyleGeneration() const { return mRestyleGeneration; }
uint64_t GetRestyleGeneration() const { return mRestyleGeneration; }
// Unlike GetRestyleGeneration, which means the actual restyling count,
// GetUndisplayedRestyleGeneration represents any possible DOM changes that
// can cause restyling. This is needed for getComputedStyle to work with
// non-styled (e.g. display: none) elements.
uint32_t GetUndisplayedRestyleGeneration() const {
uint64_t GetUndisplayedRestyleGeneration() const {
return mUndisplayedRestyleGeneration;
}
@ -263,8 +263,8 @@ protected:
private:
nsPresContext* mPresContext; // weak, can be null after Disconnect().
uint32_t mRestyleGeneration;
uint32_t mUndisplayedRestyleGeneration;
uint64_t mRestyleGeneration;
uint64_t mUndisplayedRestyleGeneration;
uint32_t mHoverGeneration;
// Used to keep track of frames that have been destroyed during