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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 bool displayItemConstructionIsDisabled() const { return m_constructionDisabl ed; } | 130 bool displayItemConstructionIsDisabled() const { return m_constructionDisabl ed; } |
131 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi onDisabled = disable; } | 131 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi onDisabled = disable; } |
132 | 132 |
133 bool subsequenceCachingIsDisabled() const { return m_subsequenceCachingDisab led; } | |
chrishtr
2016/01/04 17:32:08
Add a comment that these are used only benchmarkin
Xianzhu
2016/01/04 17:39:55
Done.
| |
134 void setSubsequenceCachingIsDisabled(bool disable) { m_subsequenceCachingDis abled = disable; } | |
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 |
142 #ifndef NDEBUG | 145 #ifndef NDEBUG |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 | 177 |
175 #if ENABLE(ASSERT) | 178 #if ENABLE(ASSERT) |
176 void assertDisplayItemClientsAreLive(); | 179 void assertDisplayItemClientsAreLive(); |
177 #endif | 180 #endif |
178 | 181 |
179 protected: | 182 protected: |
180 PaintController() | 183 PaintController() |
181 : m_newDisplayItemList(kInitialDisplayItemListCapacityBytes) | 184 : m_newDisplayItemList(kInitialDisplayItemListCapacityBytes) |
182 , m_validlyCachedClientsDirty(false) | 185 , m_validlyCachedClientsDirty(false) |
183 , m_constructionDisabled(false) | 186 , m_constructionDisabled(false) |
187 , m_subsequenceCachingDisabled(false) | |
184 , m_textPainted(false) | 188 , m_textPainted(false) |
185 , m_imagePainted(false) | 189 , m_imagePainted(false) |
186 , m_skippingCacheCount(0) | 190 , m_skippingCacheCount(0) |
187 , m_numCachedNewItems(0) | 191 , m_numCachedNewItems(0) |
188 , m_nextScope(1) { } | 192 , m_nextScope(1) { } |
189 | 193 |
190 private: | 194 private: |
191 // Set new item state (scopes, cache skipping, etc) for a new item. | 195 // Set new item state (scopes, cache skipping, etc) for a new item. |
192 void processNewItem(DisplayItem&); | 196 void processNewItem(DisplayItem&); |
193 | 197 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 #if ENABLE(ASSERT) | 248 #if ENABLE(ASSERT) |
245 // Set of clients which had paint offset changes since the last commit. This is used for | 249 // Set of clients which had paint offset changes since the last commit. This is used for |
246 // ensuring paint offsets are only updated once and are the same in all phas es. | 250 // ensuring paint offsets are only updated once and are the same in all phas es. |
247 HashSet<const DisplayItemClient*> m_clientsWithPaintOffsetInvalidations; | 251 HashSet<const DisplayItemClient*> m_clientsWithPaintOffsetInvalidations; |
248 #endif | 252 #endif |
249 | 253 |
250 // Allow display item construction to be disabled to isolate the costs of co nstruction | 254 // Allow display item construction to be disabled to isolate the costs of co nstruction |
251 // in performance metrics. | 255 // in performance metrics. |
252 bool m_constructionDisabled; | 256 bool m_constructionDisabled; |
253 | 257 |
258 // Allow subsequence caching to be disabled to test the cost of display item caching. | |
259 bool m_subsequenceCachingDisabled; | |
260 | |
254 // Indicates this PaintController has ever had text. It is never reset to fa lse. | 261 // Indicates this PaintController has ever had text. It is never reset to fa lse. |
255 bool m_textPainted; | 262 bool m_textPainted; |
256 bool m_imagePainted; | 263 bool m_imagePainted; |
257 | 264 |
258 int m_skippingCacheCount; | 265 int m_skippingCacheCount; |
259 | 266 |
260 int m_numCachedNewItems; | 267 int m_numCachedNewItems; |
261 | 268 |
262 unsigned m_nextScope; | 269 unsigned m_nextScope; |
263 Vector<unsigned> m_scopeStack; | 270 Vector<unsigned> m_scopeStack; |
264 | 271 |
265 #if ENABLE(ASSERT) | 272 #if ENABLE(ASSERT) |
266 // Record the debug names of invalidated clients for assertion and debugging . | 273 // Record the debug names of invalidated clients for assertion and debugging . |
267 Vector<String> m_invalidations; | 274 Vector<String> m_invalidations; |
268 | 275 |
269 // This is used to check duplicated ids during add(). We could also check | 276 // This is used to check duplicated ids during add(). We could also check |
270 // during commitNewDisplayItems(), but checking during add() helps developer | 277 // during commitNewDisplayItems(), but checking during add() helps developer |
271 // easily find where the duplicated ids are from. | 278 // easily find where the duplicated ids are from. |
272 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 279 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
273 #endif | 280 #endif |
274 | 281 |
275 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; | 282 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; |
276 }; | 283 }; |
277 | 284 |
278 } // namespace blink | 285 } // namespace blink |
279 | 286 |
280 #endif // PaintController_h | 287 #endif // PaintController_h |
OLD | NEW |