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..fb2bb9b6847a6006a3a7e02e950e69fff04aadaa 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h |
| @@ -63,7 +63,11 @@ public: |
| PaintInvalidationReason getPaintInvalidationReason() const { return m_cacheGenerationOrInvalidationReason.getPaintInvalidationReason(); } |
| + // A client is considered "just created" if it's display items have never been committed. |
|
chrishtr
2016/07/19 17:27:52
s/it's/its/
Xianzhu
2016/07/19 21:57:48
Done.
|
| + bool isJustCreated() const { return m_cacheGenerationOrInvalidationReason.isJustCreated(); } |
| + |
| private: |
| + friend class FakeDisplayItemClient; |
| friend class PaintController; |
| // Holds a unique cache generation id of DisplayItemClients and PaintControllers, |
| @@ -81,12 +85,16 @@ private: |
| // only. The client will be treated as invalid on other paint controllers regardless if |
| // it's validly cached by these paint controllers. The situation is very rare (about 0.07% |
| // clients were painted on multiple paint controllers) so the performance penalty is trivial. |
| - class CacheGenerationOrInvalidationReason { |
| + class PLATFORM_EXPORT CacheGenerationOrInvalidationReason { |
| DISALLOW_NEW(); |
| public: |
| - CacheGenerationOrInvalidationReason() { invalidate(); } |
| + CacheGenerationOrInvalidationReason() : m_value(kPLATFORM_EXPORTPLATFORM_EXPORTJustCreated) { } |
| - void invalidate(PaintInvalidationReason reason = PaintInvalidationFull) { m_value = static_cast<ValueType>(reason); } |
| + void invalidate(PaintInvalidationReason reason = PaintInvalidationFull) |
| + { |
| + if (m_value != kJustCreated) |
| + m_value = static_cast<ValueType>(reason); |
| + } |
| static CacheGenerationOrInvalidationReason next() |
| { |
| @@ -103,14 +111,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; |
|
chrishtr
2016/07/19 17:27:52
Where is m_value ever set to kJustCreated?
Xianzhu
2016/07/19 21:57:48
It's supposed to be at line 91. I uploaded a wrong
|
| + static const ValueType kFirstValidGeneration = static_cast<ValueType>(PaintInvalidationReasonMax) + 2; |
| static ValueType s_nextGeneration; |
| ValueType m_value; |
| }; |