Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemList.h

Issue 1363613002: Save previous paint offset in LayoutObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: No union (many compilers don't allow constructors); Fix a typo perhaps caused by switching to combiā€¦ Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 DisplayItemList_h 5 #ifndef DisplayItemList_h
6 #define DisplayItemList_h 6 #define DisplayItemList_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/LayoutPoint.h" 10 #include "platform/geometry/LayoutPoint.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 void invalidate(const DisplayItemClientWrapper&); 68 void invalidate(const DisplayItemClientWrapper&);
69 void invalidateUntracked(DisplayItemClient); 69 void invalidateUntracked(DisplayItemClient);
70 void invalidateAll(); 70 void invalidateAll();
71 71
72 // Record when paint offsets change during paint. 72 // Record when paint offsets change during paint.
73 void invalidatePaintOffset(const DisplayItemClientWrapper&); 73 void invalidatePaintOffset(const DisplayItemClientWrapper&);
74 #if ENABLE(ASSERT) 74 #if ENABLE(ASSERT)
75 bool paintOffsetWasInvalidated(DisplayItemClient) const; 75 bool paintOffsetWasInvalidated(DisplayItemClient) const;
76 #endif 76 #endif
77 77
78 // Record a new paint offset.
79 // TODO(pdr): Remove these once the paint offset cache is on LayoutObject.
80 void recordPaintOffset(DisplayItemClient, const LayoutPoint&);
81 bool paintOffsetIsUnchanged(DisplayItemClient, const LayoutPoint&) const;
82
83 // These methods are called during painting. 78 // These methods are called during painting.
84 template <typename DisplayItemClass, typename... Args> 79 template <typename DisplayItemClass, typename... Args>
85 DisplayItemClass& createAndAppend(Args&&... args) 80 DisplayItemClass& createAndAppend(Args&&... args)
86 { 81 {
87 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value, 82 static_assert(WTF::IsSubclass<DisplayItemClass, DisplayItem>::value,
88 "Can only createAndAppend subclasses of DisplayItem."); 83 "Can only createAndAppend subclasses of DisplayItem.");
89 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize, 84 static_assert(sizeof(DisplayItemClass) <= kMaximumDisplayItemSize,
90 "DisplayItem subclass is larger than kMaximumDisplayItemSize."); 85 "DisplayItem subclass is larger than kMaximumDisplayItemSize.");
91 86
92 DisplayItemClass& displayItem = m_newDisplayItems.allocateAndConstruct<D isplayItemClass>(WTF::forward<Args>(args)...); 87 DisplayItemClass& displayItem = m_newDisplayItems.allocateAndConstruct<D isplayItemClass>(WTF::forward<Args>(args)...);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 , m_skippingCacheCount(0) 163 , m_skippingCacheCount(0)
169 , m_numCachedItems(0) 164 , m_numCachedItems(0)
170 , m_nextScope(1) { } 165 , m_nextScope(1) { }
171 166
172 private: 167 private:
173 // Set new item state (scopes, cache skipping, etc) for a new item. 168 // Set new item state (scopes, cache skipping, etc) for a new item.
174 void processNewItem(DisplayItem&); 169 void processNewItem(DisplayItem&);
175 170
176 void updateValidlyCachedClientsIfNeeded() const; 171 void updateValidlyCachedClientsIfNeeded() const;
177 172
178 // Update the recorded paint offsets to remove any items that no longer have
179 // corresponding cached display items.
180 // TODO(pdr): Remove this once the paint offset cache is on LayoutObject.
181 void removeUnneededPaintOffsetEntries();
182
183 #ifndef NDEBUG 173 #ifndef NDEBUG
184 WTF::String displayItemsAsDebugString(const DisplayItems&) const; 174 WTF::String displayItemsAsDebugString(const DisplayItems&) const;
185 #endif 175 #endif
186 176
187 // Indices into PaintList of all DrawingDisplayItems and BeginSubsequenceDis playItems of each client. 177 // Indices into PaintList of all DrawingDisplayItems and BeginSubsequenceDis playItems of each client.
188 // Temporarily used during merge to find out-of-order display items. 178 // Temporarily used during merge to find out-of-order display items.
189 using DisplayItemIndicesByClientMap = HashMap<DisplayItemClient, Vector<size _t>>; 179 using DisplayItemIndicesByClientMap = HashMap<DisplayItemClient, Vector<size _t>>;
190 180
191 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Displa yItemIndicesByClientMap&, const DisplayItems&); 181 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, const Displa yItemIndicesByClientMap&, const DisplayItems&);
192 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Display ItemIndicesByClientMap&); 182 static void addItemToIndexIfNeeded(const DisplayItem&, size_t index, Display ItemIndicesByClientMap&);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 // in performance metrics. 216 // in performance metrics.
227 bool m_constructionDisabled; 217 bool m_constructionDisabled;
228 218
229 int m_skippingCacheCount; 219 int m_skippingCacheCount;
230 220
231 int m_numCachedItems; 221 int m_numCachedItems;
232 222
233 unsigned m_nextScope; 223 unsigned m_nextScope;
234 Vector<unsigned> m_scopeStack; 224 Vector<unsigned> m_scopeStack;
235 225
236 // Cache of LayoutObject paint offsets.
237 // TODO(pdr): This should be on LayoutObject itself and is only on the displ ay
238 // item list temporarily until paint invalidation for v2 frees up space on
239 // LayoutObject.
240 using PreviousPaintOffsets = HashMap<DisplayItemClient, LayoutPoint>;
241 PreviousPaintOffsets m_previousPaintOffsets;
242
243 #if ENABLE(ASSERT) 226 #if ENABLE(ASSERT)
244 // This is used to check duplicated ids during add(). We could also check du ring 227 // This is used to check duplicated ids during add(). We could also check du ring
245 // updatePaintList(), but checking during add() helps developer easily find where 228 // updatePaintList(), but checking during add() helps developer easily find where
246 // the duplicated ids are from. 229 // the duplicated ids are from.
247 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; 230 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient;
248 #endif 231 #endif
249 232
250 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects; 233 OwnPtr<Vector<String>> m_trackedPaintInvalidationObjects;
251 }; 234 };
252 235
253 } // namespace blink 236 } // namespace blink
254 237
255 #endif // DisplayItemList_h 238 #endif // DisplayItemList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698