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

Side by Side Diff: Source/platform/graphics/paint/DisplayItemList.cpp

Issue 1205703003: Add tracing for ContentLayerDelegate paintContents and DisplayItemList commit. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "config.h" 5 #include "config.h"
6 #include "platform/graphics/paint/DisplayItemList.h" 6 #include "platform/graphics/paint/DisplayItemList.h"
7 7
8 #include "platform/NotImplemented.h" 8 #include "platform/NotImplemented.h"
9 #include "platform/RuntimeEnabledFeatures.h" 9 #include "platform/RuntimeEnabledFeatures.h"
10 #include "platform/TraceEvent.h" 10 #include "platform/TraceEvent.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #endif 59 #endif
60 m_newDisplayItems.removeLast(); 60 m_newDisplayItems.removeLast();
61 } 61 }
62 62
63 void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem) 63 void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem)
64 { 64 {
65 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); 65 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled());
66 ASSERT(!m_constructionDisabled); 66 ASSERT(!m_constructionDisabled);
67 ASSERT(!skippingCache() || !displayItem->isCached()); 67 ASSERT(!skippingCache() || !displayItem->isCached());
68 68
69 if (DisplayItem::isCachedType(displayItem->type()))
70 ++m_numCachedItems;
71
69 #if ENABLE(ASSERT) 72 #if ENABLE(ASSERT)
70 // Verify noop begin/end pairs have been removed. 73 // Verify noop begin/end pairs have been removed.
71 if (!m_newDisplayItems.isEmpty() && m_newDisplayItems.last().isBegin() && !m _newDisplayItems.last().drawsContent()) 74 if (!m_newDisplayItems.isEmpty() && m_newDisplayItems.last().isBegin() && !m _newDisplayItems.last().drawsContent())
72 ASSERT(!displayItem->isEndAndPairedWith(m_newDisplayItems.last().type()) ); 75 ASSERT(!displayItem->isEndAndPairedWith(m_newDisplayItems.last().type()) );
73 #endif 76 #endif
74 77
75 if (!m_scopeStack.isEmpty()) 78 if (!m_scopeStack.isEmpty())
76 displayItem->setScope(m_scopeStack.last().id, m_scopeStack.last().client ); 79 displayItem->setScope(m_scopeStack.last().id, m_scopeStack.last().client );
77 80
78 #if ENABLE(ASSERT) 81 #if ENABLE(ASSERT)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // - FIXME: Re-enable SubtreeCachedDisplayItem: 211 // - FIXME: Re-enable SubtreeCachedDisplayItem:
209 // For SubtreeCachedDisplayItem, copy the cached display items between the 212 // For SubtreeCachedDisplayItem, copy the cached display items between the
210 // corresponding BeginSubtreeDisplayItem and EndSubtreeDisplayItem (incl.); 213 // corresponding BeginSubtreeDisplayItem and EndSubtreeDisplayItem (incl.);
211 // - Otherwise, copy the new display item. 214 // - Otherwise, copy the new display item.
212 // 215 //
213 // The algorithm is O(|m_currentDisplayItems| + |m_newDisplayItems|). 216 // The algorithm is O(|m_currentDisplayItems| + |m_newDisplayItems|).
214 // Coefficients are related to the ratio of out-of-order [Subtree]CachedDisplayI tems 217 // Coefficients are related to the ratio of out-of-order [Subtree]CachedDisplayI tems
215 // and the average number of (Drawing|BeginSubtree)DisplayItems per client. 218 // and the average number of (Drawing|BeginSubtree)DisplayItems per client.
216 void DisplayItemList::commitNewDisplayItems() 219 void DisplayItemList::commitNewDisplayItems()
217 { 220 {
218 TRACE_EVENT0("blink,benchmark", "DisplayItemList::commitNewDisplayItems"); 221 TRACE_EVENT2("blink,benchmark", "DisplayItemList::commitNewDisplayItems", "c urrent_display_list_size", (int)m_currentDisplayItems.size(),
222 "num_non_cached_new_items", (int)m_newDisplayItems.size() - m_numCachedI tems);
219 223
220 // These data structures are used during painting only. 224 // These data structures are used during painting only.
221 m_clientScopeIdMap.clear(); 225 m_clientScopeIdMap.clear();
222 ASSERT(m_scopeStack.isEmpty()); 226 ASSERT(m_scopeStack.isEmpty());
223 m_scopeStack.clear(); 227 m_scopeStack.clear();
224 ASSERT(!skippingCache()); 228 ASSERT(!skippingCache());
225 #if ENABLE(ASSERT) 229 #if ENABLE(ASSERT)
226 m_newDisplayItemIndicesByClient.clear(); 230 m_newDisplayItemIndicesByClient.clear();
227 #endif 231 #endif
228 232
229 if (m_currentDisplayItems.isEmpty()) { 233 if (m_currentDisplayItems.isEmpty()) {
230 #if ENABLE(ASSERT) 234 #if ENABLE(ASSERT)
231 for (auto& item : m_newDisplayItems) { 235 for (auto& item : m_newDisplayItems) {
232 ASSERT(!DisplayItem::isCachedType(item.type()) 236 ASSERT(!DisplayItem::isCachedType(item.type())
233 && !DisplayItem::isSubtreeCachedType(item.type())); 237 && !DisplayItem::isSubtreeCachedType(item.type()));
234 } 238 }
235 #endif 239 #endif
236 m_currentDisplayItems.swap(m_newDisplayItems); 240 m_currentDisplayItems.swap(m_newDisplayItems);
237 m_validlyCachedClientsDirty = true; 241 m_validlyCachedClientsDirty = true;
242 m_numCachedItems = 0;
238 return; 243 return;
239 } 244 }
240 245
241 updateValidlyCachedClientsIfNeeded(); 246 updateValidlyCachedClientsIfNeeded();
242 247
243 // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that have not been matched 248 // Stores indices to valid DrawingDisplayItems in m_currentDisplayItems that have not been matched
244 // by CachedDisplayItems during synchronized matching. The indexed items wil l be matched 249 // by CachedDisplayItems during synchronized matching. The indexed items wil l be matched
245 // by later out-of-order CachedDisplayItems in m_newDisplayItems. This ensur es that when 250 // by later out-of-order CachedDisplayItems in m_newDisplayItems. This ensur es that when
246 // out-of-order CachedDisplayItems occur, we only traverse at most once over m_currentDisplayItems 251 // out-of-order CachedDisplayItems occur, we only traverse at most once over m_currentDisplayItems
247 // looking for potential matches. Thus we can ensure that the algorithm runs in linear time. 252 // looking for potential matches. Thus we can ensure that the algorithm runs in linear time.
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 318
314 #if ENABLE(ASSERT) 319 #if ENABLE(ASSERT)
315 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) 320 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled())
316 checkNoRemainingCachedDisplayItems(); 321 checkNoRemainingCachedDisplayItems();
317 #endif // ENABLE(ASSERT) 322 #endif // ENABLE(ASSERT)
318 323
319 m_newDisplayItems.clear(); 324 m_newDisplayItems.clear();
320 m_validlyCachedClientsDirty = true; 325 m_validlyCachedClientsDirty = true;
321 m_currentDisplayItems.clear(); 326 m_currentDisplayItems.clear();
322 m_currentDisplayItems.swap(updatedList); 327 m_currentDisplayItems.swap(updatedList);
328 m_numCachedItems = 0;
323 } 329 }
324 330
325 void DisplayItemList::updateValidlyCachedClientsIfNeeded() const 331 void DisplayItemList::updateValidlyCachedClientsIfNeeded() const
326 { 332 {
327 if (!m_validlyCachedClientsDirty) 333 if (!m_validlyCachedClientsDirty)
328 return; 334 return;
329 335
330 m_validlyCachedClients.clear(); 336 m_validlyCachedClients.clear();
331 m_validlyCachedClientsDirty = false; 337 m_validlyCachedClientsDirty = false;
332 338
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 496
491 void DisplayItemList::replay(GraphicsContext& context) const 497 void DisplayItemList::replay(GraphicsContext& context) const
492 { 498 {
493 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); 499 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay");
494 ASSERT(m_newDisplayItems.isEmpty()); 500 ASSERT(m_newDisplayItems.isEmpty());
495 for (auto& displayItem : m_currentDisplayItems) 501 for (auto& displayItem : m_currentDisplayItems)
496 displayItem.replay(context); 502 displayItem.replay(context);
497 } 503 }
498 504
499 } // namespace blink 505 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/paint/DisplayItemList.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698