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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void setTextPainted() { m_textPainted = true; } | 143 void setTextPainted() { m_textPainted = true; } |
144 bool imagePainted() const { return m_imagePainted; } | 144 bool imagePainted() const { return m_imagePainted; } |
145 void setImagePainted() { m_imagePainted = true; } | 145 void setImagePainted() { m_imagePainted = true; } |
146 | 146 |
147 // Returns displayItemList added using createAndAppend() since beginning or | 147 // Returns displayItemList added using createAndAppend() since beginning or |
148 // the last commitNewDisplayItems(). Use with care. | 148 // the last commitNewDisplayItems(). Use with care. |
149 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } | 149 DisplayItemList& newDisplayItemList() { return m_newDisplayItemList; } |
150 | 150 |
151 void appendDebugDrawingAfterCommit(const DisplayItemClient&, sk_sp<SkPicture
>, const LayoutSize& offsetFromLayoutObject); | 151 void appendDebugDrawingAfterCommit(const DisplayItemClient&, sk_sp<SkPicture
>, const LayoutSize& offsetFromLayoutObject); |
152 | 152 |
153 void showDebugData() const; | 153 void showDebugData() const { showDebugDataInternal(false); } |
| 154 #ifndef NDEBUG |
| 155 void showDebugDataWithPictures() const { showDebugDataInternal(true); } |
| 156 #endif |
154 | 157 |
155 #if DCHECK_IS_ON() | 158 #if DCHECK_IS_ON() |
156 void assertDisplayItemClientsAreLive(); | 159 void assertDisplayItemClientsAreLive(); |
157 #endif | 160 #endif |
158 | 161 |
159 protected: | 162 protected: |
160 PaintController() | 163 PaintController() |
161 : m_newDisplayItemList(0) | 164 : m_newDisplayItemList(0) |
162 , m_constructionDisabled(false) | 165 , m_constructionDisabled(false) |
163 , m_subsequenceCachingDisabled(false) | 166 , m_subsequenceCachingDisabled(false) |
(...skipping 20 matching lines...) Expand all Loading... |
184 if (m_newDisplayItemList.isEmpty()) { | 187 if (m_newDisplayItemList.isEmpty()) { |
185 // TODO(wangxianzhu): Consider revisiting this heuristic. | 188 // TODO(wangxianzhu): Consider revisiting this heuristic. |
186 m_newDisplayItemList = DisplayItemList(m_currentPaintArtifact.getDis
playItemList().isEmpty() ? kInitialDisplayItemListCapacityBytes : m_currentPaint
Artifact.getDisplayItemList().usedCapacityInBytes()); | 189 m_newDisplayItemList = DisplayItemList(m_currentPaintArtifact.getDis
playItemList().isEmpty() ? kInitialDisplayItemListCapacityBytes : m_currentPaint
Artifact.getDisplayItemList().usedCapacityInBytes()); |
187 } | 190 } |
188 } | 191 } |
189 | 192 |
190 // Set new item state (cache skipping, etc) for a new item. | 193 // Set new item state (cache skipping, etc) for a new item. |
191 enum NewItemSource { FromCachedItem, FromCachedSubsequence, NewPainting }; | 194 enum NewItemSource { FromCachedItem, FromCachedSubsequence, NewPainting }; |
192 void processNewItem(DisplayItem&, NewItemSource); | 195 void processNewItem(DisplayItem&, NewItemSource); |
193 | 196 |
194 String displayItemListAsDebugString(const DisplayItemList&) const; | 197 void showDebugDataInternal(bool showPictures) const; |
| 198 String displayItemListAsDebugString(const DisplayItemList&, bool showPicture
s) const; |
195 | 199 |
196 // Maps clients to indices of display items or chunks of each client. | 200 // Maps clients to indices of display items or chunks of each client. |
197 using IndicesByClientMap = HashMap<const DisplayItemClient*, Vector<size_t>>
; | 201 using IndicesByClientMap = HashMap<const DisplayItemClient*, Vector<size_t>>
; |
198 | 202 |
199 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Indice
sByClientMap&, const DisplayItemList&); | 203 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Indice
sByClientMap&, const DisplayItemList&); |
200 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Indices
ByClientMap&); | 204 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Indices
ByClientMap&); |
201 | 205 |
202 size_t findCachedItem(const DisplayItem::Id&); | 206 size_t findCachedItem(const DisplayItem::Id&); |
203 size_t findOutOfOrderCachedItemForward(const DisplayItem::Id&); | 207 size_t findOutOfOrderCachedItemForward(const DisplayItem::Id&); |
204 void copyCachedSubsequence(size_t&); | 208 void copyCachedSubsequence(size_t&); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 295 |
292 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 296 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
293 // A stack recording subsequence clients that are currently painting. | 297 // A stack recording subsequence clients that are currently painting. |
294 Vector<const DisplayItemClient*> m_currentSubsequenceClients; | 298 Vector<const DisplayItemClient*> m_currentSubsequenceClients; |
295 #endif | 299 #endif |
296 }; | 300 }; |
297 | 301 |
298 } // namespace blink | 302 } // namespace blink |
299 | 303 |
300 #endif // PaintController_h | 304 #endif // PaintController_h |
OLD | NEW |