| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PaintController_h | 5 #ifndef PaintController_h |
| 6 #define PaintController_h | 6 #define PaintController_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/geometry/IntRect.h" | 10 #include "platform/geometry/IntRect.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 size_t approximateUnsharedMemoryUsage() const; | 120 size_t approximateUnsharedMemoryUsage() const; |
| 121 | 121 |
| 122 // Get the artifact generated after the last commit. | 122 // Get the artifact generated after the last commit. |
| 123 const PaintArtifact& paintArtifact() const; | 123 const PaintArtifact& paintArtifact() const; |
| 124 const DisplayItemList& displayItemList() const { return paintArtifact().disp
layItemList(); } | 124 const DisplayItemList& displayItemList() const { return paintArtifact().disp
layItemList(); } |
| 125 const Vector<PaintChunk>& paintChunks() const { return paintArtifact().paint
Chunks(); } | 125 const Vector<PaintChunk>& paintChunks() const { return paintArtifact().paint
Chunks(); } |
| 126 | 126 |
| 127 bool clientCacheIsValid(const DisplayItemClient&) const; | 127 bool clientCacheIsValid(const DisplayItemClient&) const; |
| 128 bool cacheIsEmpty() const { return m_currentPaintArtifact.isEmpty(); } | 128 bool cacheIsEmpty() const { return m_currentPaintArtifact.isEmpty(); } |
| 129 | 129 |
| 130 // For micro benchmarking of record time. |
| 130 bool displayItemConstructionIsDisabled() const { return m_constructionDisabl
ed; } | 131 bool displayItemConstructionIsDisabled() const { return m_constructionDisabl
ed; } |
| 131 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi
onDisabled = disable; } | 132 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi
onDisabled = disable; } |
| 133 bool subsequenceCachingIsDisabled() const { return m_subsequenceCachingDisab
led; } |
| 134 void setSubsequenceCachingIsDisabled(bool disable) { m_subsequenceCachingDis
abled = disable; } |
| 132 | 135 |
| 133 bool textPainted() const { return m_textPainted; } | 136 bool textPainted() const { return m_textPainted; } |
| 134 void setTextPainted() { m_textPainted = true; } | 137 void setTextPainted() { m_textPainted = true; } |
| 135 bool imagePainted() const { return m_imagePainted; } | 138 bool imagePainted() const { return m_imagePainted; } |
| 136 void setImagePainted() { m_imagePainted = true; } | 139 void setImagePainted() { m_imagePainted = true; } |
| 137 | 140 |
| 138 // Returns displayItemList added using createAndAppend() since beginning or | 141 // Returns displayItemList added using createAndAppend() since beginning or |
| 139 // the last commitNewDisplayItems(). Use with care. | 142 // the last commitNewDisplayItems(). Use with care. |
| 140 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } | 143 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } |
| 141 | 144 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 179 |
| 177 #if ENABLE(ASSERT) | 180 #if ENABLE(ASSERT) |
| 178 void assertDisplayItemClientsAreLive(); | 181 void assertDisplayItemClientsAreLive(); |
| 179 #endif | 182 #endif |
| 180 | 183 |
| 181 protected: | 184 protected: |
| 182 PaintController() | 185 PaintController() |
| 183 : m_newDisplayItemList(kInitialDisplayItemListCapacityBytes) | 186 : m_newDisplayItemList(kInitialDisplayItemListCapacityBytes) |
| 184 , m_validlyCachedClientsDirty(false) | 187 , m_validlyCachedClientsDirty(false) |
| 185 , m_constructionDisabled(false) | 188 , m_constructionDisabled(false) |
| 189 , m_subsequenceCachingDisabled(false) |
| 186 , m_textPainted(false) | 190 , m_textPainted(false) |
| 187 , m_imagePainted(false) | 191 , m_imagePainted(false) |
| 188 , m_skippingCacheCount(0) | 192 , m_skippingCacheCount(0) |
| 189 , m_numCachedNewItems(0) | 193 , m_numCachedNewItems(0) |
| 190 , m_nextScope(1) { } | 194 , m_nextScope(1) { } |
| 191 | 195 |
| 192 private: | 196 private: |
| 193 // Set new item state (scopes, cache skipping, etc) for a new item. | 197 // Set new item state (scopes, cache skipping, etc) for a new item. |
| 194 void processNewItem(DisplayItem&); | 198 void processNewItem(DisplayItem&); |
| 195 | 199 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 #if ENABLE(ASSERT) | 250 #if ENABLE(ASSERT) |
| 247 // Set of clients which had paint offset changes since the last commit. This
is used for | 251 // Set of clients which had paint offset changes since the last commit. This
is used for |
| 248 // ensuring paint offsets are only updated once and are the same in all phas
es. | 252 // ensuring paint offsets are only updated once and are the same in all phas
es. |
| 249 HashSet<const DisplayItemClient*> m_clientsWithPaintOffsetInvalidations; | 253 HashSet<const DisplayItemClient*> m_clientsWithPaintOffsetInvalidations; |
| 250 #endif | 254 #endif |
| 251 | 255 |
| 252 // Allow display item construction to be disabled to isolate the costs of co
nstruction | 256 // Allow display item construction to be disabled to isolate the costs of co
nstruction |
| 253 // in performance metrics. | 257 // in performance metrics. |
| 254 bool m_constructionDisabled; | 258 bool m_constructionDisabled; |
| 255 | 259 |
| 260 // Allow subsequence caching to be disabled to test the cost of display item
caching. |
| 261 bool m_subsequenceCachingDisabled; |
| 262 |
| 256 // Indicates this PaintController has ever had text. It is never reset to fa
lse. | 263 // Indicates this PaintController has ever had text. It is never reset to fa
lse. |
| 257 bool m_textPainted; | 264 bool m_textPainted; |
| 258 bool m_imagePainted; | 265 bool m_imagePainted; |
| 259 | 266 |
| 260 int m_skippingCacheCount; | 267 int m_skippingCacheCount; |
| 261 | 268 |
| 262 int m_numCachedNewItems; | 269 int m_numCachedNewItems; |
| 263 | 270 |
| 264 unsigned m_nextScope; | 271 unsigned m_nextScope; |
| 265 Vector<unsigned> m_scopeStack; | 272 Vector<unsigned> m_scopeStack; |
| 266 | 273 |
| 267 #if ENABLE(ASSERT) | 274 #if ENABLE(ASSERT) |
| 268 // Record the debug names of invalidated clients for assertion and debugging
. | 275 // Record the debug names of invalidated clients for assertion and debugging
. |
| 269 Vector<String> m_invalidations; | 276 Vector<String> m_invalidations; |
| 270 | 277 |
| 271 // This is used to check duplicated ids during add(). We could also check | 278 // This is used to check duplicated ids during add(). We could also check |
| 272 // during commitNewDisplayItems(), but checking during add() helps developer | 279 // during commitNewDisplayItems(), but checking during add() helps developer |
| 273 // easily find where the duplicated ids are from. | 280 // easily find where the duplicated ids are from. |
| 274 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 281 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 275 #endif | 282 #endif |
| 276 | 283 |
| 277 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 284 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
| 278 }; | 285 }; |
| 279 | 286 |
| 280 } // namespace blink | 287 } // namespace blink |
| 281 | 288 |
| 282 #endif // PaintController_h | 289 #endif // PaintController_h |
| OLD | NEW |