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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 void setDisplayItemConstructionIsDisabled(const bool disable) { | 153 void setDisplayItemConstructionIsDisabled(const bool disable) { |
154 m_constructionDisabled = disable; | 154 m_constructionDisabled = disable; |
155 } | 155 } |
156 bool subsequenceCachingIsDisabled() const { | 156 bool subsequenceCachingIsDisabled() const { |
157 return m_subsequenceCachingDisabled; | 157 return m_subsequenceCachingDisabled; |
158 } | 158 } |
159 void setSubsequenceCachingIsDisabled(bool disable) { | 159 void setSubsequenceCachingIsDisabled(bool disable) { |
160 m_subsequenceCachingDisabled = disable; | 160 m_subsequenceCachingDisabled = disable; |
161 } | 161 } |
162 | 162 |
| 163 bool firstPainted() const { return m_firstPainted; } |
| 164 void setFirstPainted() { m_firstPainted = true; } |
163 bool textPainted() const { return m_textPainted; } | 165 bool textPainted() const { return m_textPainted; } |
164 void setTextPainted() { m_textPainted = true; } | 166 void setTextPainted() { m_textPainted = true; } |
165 bool imagePainted() const { return m_imagePainted; } | 167 bool imagePainted() const { return m_imagePainted; } |
166 void setImagePainted() { m_imagePainted = true; } | 168 void setImagePainted() { m_imagePainted = true; } |
167 | 169 |
168 bool nonDefaultBackgroundColorPainted() const { | |
169 return m_nonDefaultBackgroundColorPainted; | |
170 } | |
171 void setNonDefaultBackgroundColorPainted() { | |
172 m_nonDefaultBackgroundColorPainted = true; | |
173 } | |
174 | |
175 // Returns displayItemList added using createAndAppend() since beginning or | 170 // Returns displayItemList added using createAndAppend() since beginning or |
176 // the last commitNewDisplayItems(). Use with care. | 171 // the last commitNewDisplayItems(). Use with care. |
177 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } | 172 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } |
178 | 173 |
179 void appendDebugDrawingAfterCommit(const DisplayItemClient&, | 174 void appendDebugDrawingAfterCommit(const DisplayItemClient&, |
180 sk_sp<SkPicture>, | 175 sk_sp<SkPicture>, |
181 const LayoutSize& offsetFromLayoutObject); | 176 const LayoutSize& offsetFromLayoutObject); |
182 | 177 |
183 void showDebugData() const { showDebugDataInternal(false); } | 178 void showDebugData() const { showDebugDataInternal(false); } |
184 #ifndef NDEBUG | 179 #ifndef NDEBUG |
(...skipping 12 matching lines...) Expand all Loading... |
197 RasterInvalidationTrackingMap<const PaintChunk>* | 192 RasterInvalidationTrackingMap<const PaintChunk>* |
198 paintChunksRasterInvalidationTrackingMap() { | 193 paintChunksRasterInvalidationTrackingMap() { |
199 return m_paintChunksRasterInvalidationTrackingMap.get(); | 194 return m_paintChunksRasterInvalidationTrackingMap.get(); |
200 } | 195 } |
201 | 196 |
202 protected: | 197 protected: |
203 PaintController() | 198 PaintController() |
204 : m_newDisplayItemList(0), | 199 : m_newDisplayItemList(0), |
205 m_constructionDisabled(false), | 200 m_constructionDisabled(false), |
206 m_subsequenceCachingDisabled(false), | 201 m_subsequenceCachingDisabled(false), |
| 202 m_firstPainted(false), |
207 m_textPainted(false), | 203 m_textPainted(false), |
208 m_imagePainted(false), | 204 m_imagePainted(false), |
209 m_nonDefaultBackgroundColorPainted(false), | |
210 m_skippingCacheCount(0), | 205 m_skippingCacheCount(0), |
211 m_numCachedNewItems(0), | 206 m_numCachedNewItems(0), |
212 m_currentCachedSubsequenceBeginIndexInNewList(kNotFound) | 207 m_currentCachedSubsequenceBeginIndexInNewList(kNotFound) |
213 #ifndef NDEBUG | 208 #ifndef NDEBUG |
214 , | 209 , |
215 m_numSequentialMatches(0), | 210 m_numSequentialMatches(0), |
216 m_numOutOfOrderMatches(0), | 211 m_numOutOfOrderMatches(0), |
217 m_numIndexedItems(0) | 212 m_numIndexedItems(0) |
218 #endif | 213 #endif |
219 { | 214 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 Vector<size_t> m_itemsMovedIntoNewList; | 294 Vector<size_t> m_itemsMovedIntoNewList; |
300 | 295 |
301 // Allows display item construction to be disabled to isolate the costs of | 296 // Allows display item construction to be disabled to isolate the costs of |
302 // construction in performance metrics. | 297 // construction in performance metrics. |
303 bool m_constructionDisabled; | 298 bool m_constructionDisabled; |
304 | 299 |
305 // Allows subsequence caching to be disabled to test the cost of display item | 300 // Allows subsequence caching to be disabled to test the cost of display item |
306 // caching. | 301 // caching. |
307 bool m_subsequenceCachingDisabled; | 302 bool m_subsequenceCachingDisabled; |
308 | 303 |
309 // Indicates this PaintController has ever had text. It is never reset to | 304 // The following fields indicate that this PaintController has ever had |
310 // false. | 305 // first-paint, text or image painted. They are never reset to false. |
| 306 // First-paint is defined in https://github.com/WICG/paint-timing. It excludes |
| 307 // default background paint. |
| 308 bool m_firstPainted; |
311 bool m_textPainted; | 309 bool m_textPainted; |
312 bool m_imagePainted; | 310 bool m_imagePainted; |
313 bool m_nonDefaultBackgroundColorPainted; | |
314 | 311 |
315 int m_skippingCacheCount; | 312 int m_skippingCacheCount; |
316 | 313 |
317 int m_numCachedNewItems; | 314 int m_numCachedNewItems; |
318 | 315 |
319 // Stores indices to valid cacheable display items in | 316 // Stores indices to valid cacheable display items in |
320 // m_currentPaintArtifact.displayItemList() that have not been matched by | 317 // m_currentPaintArtifact.displayItemList() that have not been matched by |
321 // requests of cached display items (using useCachedDrawingIfPossible() and | 318 // requests of cached display items (using useCachedDrawingIfPossible() and |
322 // useCachedSubsequenceIfPossible()) during sequential matching. The indexed | 319 // useCachedSubsequenceIfPossible()) during sequential matching. The indexed |
323 // items will be matched by later out-of-order requests of cached display | 320 // items will be matched by later out-of-order requests of cached display |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 376 |
380 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 377 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
381 // A stack recording subsequence clients that are currently painting. | 378 // A stack recording subsequence clients that are currently painting. |
382 Vector<const DisplayItemClient*> m_currentSubsequenceClients; | 379 Vector<const DisplayItemClient*> m_currentSubsequenceClients; |
383 #endif | 380 #endif |
384 }; | 381 }; |
385 | 382 |
386 } // namespace blink | 383 } // namespace blink |
387 | 384 |
388 #endif // PaintController_h | 385 #endif // PaintController_h |
OLD | NEW |