Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
| index e3dc42b883a6c58de348012f02eefe01a20808d0..3637d9660ce2b2561f9843655f7e3b52b00ea2cd 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
| @@ -63,7 +63,10 @@ public: |
| PaintInvalidationReason getPaintInvalidationReason() const { return m_cacheGenerationOrInvalidationReason.getPaintInvalidationReason(); } |
| + bool isJustCreated() const { return m_cacheGenerationOrInvalidationReason.isJustCreated(); } |
|
pdr.
2016/07/15 19:11:28
Can you add a comment here?
Maybe something like:
Xianzhu
2016/07/15 23:48:00
Done.
|
| + |
| private: |
| + friend class FakeDisplayItemClient; |
| friend class PaintController; |
| // Holds a unique cache generation id of DisplayItemClients and PaintControllers, |
| @@ -84,7 +87,7 @@ private: |
| class CacheGenerationOrInvalidationReason { |
| DISALLOW_NEW(); |
| public: |
| - CacheGenerationOrInvalidationReason() { invalidate(); } |
| + CacheGenerationOrInvalidationReason() : m_value(kJustCreated) { } |
| void invalidate(PaintInvalidationReason reason = PaintInvalidationFull) { m_value = static_cast<ValueType>(reason); } |
| @@ -103,14 +106,17 @@ private: |
| PaintInvalidationReason getPaintInvalidationReason() const |
| { |
| - return m_value < kFirstValidGeneration ? static_cast<PaintInvalidationReason>(m_value) : PaintInvalidationNone; |
| + return m_value < kJustCreated ? static_cast<PaintInvalidationReason>(m_value) : PaintInvalidationNone; |
| } |
| + bool isJustCreated() const { return m_value == kJustCreated; } |
| + |
| private: |
| typedef uint32_t ValueType; |
| explicit CacheGenerationOrInvalidationReason(ValueType value) : m_value(value) { } |
| - static const ValueType kFirstValidGeneration = static_cast<ValueType>(PaintInvalidationReasonMax) + 1; |
| + static const ValueType kJustCreated = static_cast<ValueType>(PaintInvalidationReasonMax) + 1; |
| + static const ValueType kFirstValidGeneration = static_cast<ValueType>(PaintInvalidationReasonMax) + 2; |
| static ValueType s_nextGeneration; |
| ValueType m_value; |
| }; |