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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp

Issue 1755853002: Remove old paint offset caching code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
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 "platform/graphics/paint/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/NotImplemented.h" 7 #include "platform/NotImplemented.h"
8 #include "platform/TraceEvent.h" 8 #include "platform/TraceEvent.h"
9 #include "platform/graphics/GraphicsLayer.h" 9 #include "platform/graphics/GraphicsLayer.h"
10 #include "platform/graphics/paint/DrawingDisplayItem.h" 10 #include "platform/graphics/paint/DrawingDisplayItem.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bool PaintController::clientCacheIsValid(const DisplayItemClient& client) const 159 bool PaintController::clientCacheIsValid(const DisplayItemClient& client) const
160 { 160 {
161 if (skippingCache()) 161 if (skippingCache())
162 return false; 162 return false;
163 updateValidlyCachedClientsIfNeeded(); 163 updateValidlyCachedClientsIfNeeded();
164 return m_validlyCachedClients.contains(&client); 164 return m_validlyCachedClients.contains(&client);
165 } 165 }
166 166
167 void PaintController::invalidatePaintOffset(const DisplayItemClient& client) 167 void PaintController::invalidatePaintOffset(const DisplayItemClient& client)
168 { 168 {
169 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); 169 ASSERT(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
170 invalidate(client); 170 invalidate(client);
171 171
172 #if ENABLE(ASSERT) 172 #if ENABLE(ASSERT)
173 ASSERT(!paintOffsetWasInvalidated(client)); 173 ASSERT(!paintOffsetWasInvalidated(client));
174 m_clientsWithPaintOffsetInvalidations.add(&client); 174 m_clientsWithPaintOffsetInvalidations.add(&client);
175 #endif 175 #endif
176 } 176 }
177 177
178 #if ENABLE(ASSERT) 178 #if ENABLE(ASSERT)
179 bool PaintController::paintOffsetWasInvalidated(const DisplayItemClient& client) const 179 bool PaintController::paintOffsetWasInvalidated(const DisplayItemClient& client) const
180 { 180 {
181 ASSERT(RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled()); 181 ASSERT(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
182 return m_clientsWithPaintOffsetInvalidations.contains(&client); 182 return m_clientsWithPaintOffsetInvalidations.contains(&client);
183 } 183 }
184 #endif 184 #endif
185 185
186 size_t PaintController::findMatchingItemFromIndex(const DisplayItem::Id& id, con st DisplayItemIndicesByClientMap& displayItemIndicesByClient, const DisplayItemL ist& list) 186 size_t PaintController::findMatchingItemFromIndex(const DisplayItem::Id& id, con st DisplayItemIndicesByClientMap& displayItemIndicesByClient, const DisplayItemL ist& list)
187 { 187 {
188 DisplayItemIndicesByClientMap::const_iterator it = displayItemIndicesByClien t.find(&id.client); 188 DisplayItemIndicesByClientMap::const_iterator it = displayItemIndicesByClien t.find(&id.client);
189 if (it == displayItemIndicesByClient.end()) 189 if (it == displayItemIndicesByClient.end())
190 return kNotFound; 190 return kNotFound;
191 191
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemLis t().end(); 341 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.displayItemLis t().end();
342 for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt ! = m_newDisplayItemList.end(); ++newIt) { 342 for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt ! = m_newDisplayItemList.end(); ++newIt) {
343 const DisplayItem& newDisplayItem = *newIt; 343 const DisplayItem& newDisplayItem = *newIt;
344 const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); 344 const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId();
345 bool newDisplayItemHasCachedType = newDisplayItem.getType() != newDispla yItemId.type; 345 bool newDisplayItemHasCachedType = newDisplayItem.getType() != newDispla yItemId.type;
346 346
347 bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matche s(*currentIt); 347 bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matche s(*currentIt);
348 348
349 if (newDisplayItemHasCachedType) { 349 if (newDisplayItemHasCachedType) {
350 ASSERT(newDisplayItem.isCached()); 350 ASSERT(newDisplayItem.isCached());
351 ASSERT(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnable dFeatures::slimmingPaintOffsetCachingEnabled() && !paintOffsetWasInvalidated(new DisplayItem.client()))); 351 ASSERT(clientCacheIsValid(newDisplayItem.client()) || (RuntimeEnable dFeatures::slimmingPaintInvalidationEnabled() && !paintOffsetWasInvalidated(newD isplayItem.client())));
352 if (!isSynchronized) { 352 if (!isSynchronized) {
353 currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrde rIndexContext); 353 currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrde rIndexContext);
354 354
355 if (currentIt == currentEnd) { 355 if (currentIt == currentEnd) {
356 #ifndef NDEBUG 356 #ifndef NDEBUG
357 showDebugData(); 357 showDebugData();
358 WTFLogAlways("%s not found in m_currentDisplayItemList\n", n ewDisplayItem.asDebugString().utf8().data()); 358 WTFLogAlways("%s not found in m_currentDisplayItemList\n", n ewDisplayItem.asDebugString().utf8().data());
359 #endif 359 #endif
360 ASSERT_NOT_REACHED(); 360 ASSERT_NOT_REACHED();
361 // We did not find the cached display item. This should be i mpossible, but may occur if there is a bug 361 // We did not find the cached display item. This should be i mpossible, but may occur if there is a bug
(...skipping 13 matching lines...) Expand all
375 ++currentIt; 375 ++currentIt;
376 } else { 376 } else {
377 ASSERT(newDisplayItem.getType() == DisplayItem::CachedSubsequenc e); 377 ASSERT(newDisplayItem.getType() == DisplayItem::CachedSubsequenc e);
378 copyCachedSubsequence(m_currentPaintArtifact.displayItemList(), currentIt, updatedList); 378 copyCachedSubsequence(m_currentPaintArtifact.displayItemList(), currentIt, updatedList);
379 ASSERT(updatedList.last().getType() == DisplayItem::EndSubsequen ce); 379 ASSERT(updatedList.last().getType() == DisplayItem::EndSubsequen ce);
380 } 380 }
381 } else { 381 } else {
382 ASSERT(!newDisplayItem.isDrawing() 382 ASSERT(!newDisplayItem.isDrawing()
383 || newDisplayItem.skippedCache() 383 || newDisplayItem.skippedCache()
384 || !clientCacheIsValid(newDisplayItem.client()) 384 || !clientCacheIsValid(newDisplayItem.client())
385 || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); 385 || (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() & & paintOffsetWasInvalidated(newDisplayItem.client())));
386 386
387 updatedList.appendByMoving(*newIt, visualRectForDisplayItem(*newIt, offsetFromLayoutObject)); 387 updatedList.appendByMoving(*newIt, visualRectForDisplayItem(*newIt, offsetFromLayoutObject));
388 388
389 if (isSynchronized) 389 if (isSynchronized)
390 ++currentIt; 390 ++currentIt;
391 } 391 }
392 // Items before currentIt should have been copied so we don't need to in dex them. 392 // Items before currentIt should have been copied so we don't need to in dex them.
393 if (currentIt - outOfOrderIndexContext.nextItemToIndex > 0) 393 if (currentIt - outOfOrderIndexContext.nextItemToIndex > 0)
394 outOfOrderIndexContext.nextItemToIndex = currentIt; 394 outOfOrderIndexContext.nextItemToIndex = currentIt;
395 } 395 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 572
573 void PaintController::showDebugData() const 573 void PaintController::showDebugData() const
574 { 574 {
575 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.displayItemList()).utf8().data()); 575 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.displayItemList()).utf8().data());
576 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); 576 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data());
577 } 577 }
578 578
579 #endif // ifndef NDEBUG 579 #endif // ifndef NDEBUG
580 580
581 } // namespace blink 581 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698