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

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

Issue 1425593007: Separate display item clients for negative and normal/positive z-order children (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Struct DisplayItemClient Created 5 years, 1 month 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 "config.h" 5 #include "config.h"
6 #include "platform/graphics/paint/PaintController.h" 6 #include "platform/graphics/paint/PaintController.h"
7 7
8 #include "platform/NotImplemented.h" 8 #include "platform/NotImplemented.h"
9 #include "platform/TraceEvent.h" 9 #include "platform/TraceEvent.h"
10 #include "platform/graphics/GraphicsLayer.h" 10 #include "platform/graphics/GraphicsLayer.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 ASSERT(!m_constructionDisabled); 59 ASSERT(!m_constructionDisabled);
60 ASSERT(!skippingCache() || !displayItem.isCached()); 60 ASSERT(!skippingCache() || !displayItem.isCached());
61 61
62 if (displayItem.isCached()) 62 if (displayItem.isCached())
63 ++m_numCachedItems; 63 ++m_numCachedItems;
64 64
65 #if ENABLE(ASSERT) 65 #if ENABLE(ASSERT)
66 // Verify noop begin/end pairs have been removed. 66 // Verify noop begin/end pairs have been removed.
67 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) { 67 if (m_newDisplayItemList.size() >= 2 && displayItem.isEnd()) {
68 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList .size() - 2]; 68 const auto& beginDisplayItem = m_newDisplayItemList[m_newDisplayItemList .size() - 2];
69 if (beginDisplayItem.isBegin() && !beginDisplayItem.isSubsequence() && ! beginDisplayItem.drawsContent()) 69 if (beginDisplayItem.isBegin() && beginDisplayItem.type() != DisplayItem ::Subsequence && !beginDisplayItem.drawsContent())
70 ASSERT(!displayItem.isEndAndPairedWith(beginDisplayItem.type())); 70 ASSERT(!displayItem.isEndAndPairedWith(beginDisplayItem.type()));
71 } 71 }
72 #endif 72 #endif
73 73
74 if (!m_scopeStack.isEmpty()) 74 if (!m_scopeStack.isEmpty())
75 displayItem.setScope(m_scopeStack.last()); 75 displayItem.setScope(m_scopeStack.last());
76 76
77 #if ENABLE(ASSERT) 77 #if ENABLE(ASSERT)
78 size_t index = findMatchingItemFromIndex(displayItem.nonCachedId(), m_newDis playItemIndicesByClient, m_newDisplayItemList); 78 size_t index = findMatchingItemFromIndex(displayItem.nonCachedId(), m_newDis playItemIndicesByClient, m_newDisplayItemList);
79 if (index != kNotFound) { 79 if (index != kNotFound) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return context.nextItemToIndex++; 239 return context.nextItemToIndex++;
240 240
241 addItemToIndexIfNeeded(item, context.nextItemToIndex - m_currentPain tArtifact.displayItemList().begin(), context.displayItemIndicesByClient); 241 addItemToIndexIfNeeded(item, context.nextItemToIndex - m_currentPain tArtifact.displayItemList().begin(), context.displayItemIndicesByClient);
242 } 242 }
243 } 243 }
244 return currentEnd; 244 return currentEnd;
245 } 245 }
246 246
247 void PaintController::copyCachedSubsequence(DisplayItemList::iterator& currentIt , DisplayItemList& updatedList) 247 void PaintController::copyCachedSubsequence(DisplayItemList::iterator& currentIt , DisplayItemList& updatedList)
248 { 248 {
249 ASSERT(currentIt->isSubsequence()); 249 ASSERT(currentIt->type() == DisplayItem::Subsequence);
250 ASSERT(!currentIt->scope()); 250 ASSERT(!currentIt->scope());
251 DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::subsequen ceTypeToEndSubsequenceType(currentIt->type()), 0); 251 DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::EndSubseq uence, 0);
252 do { 252 do {
253 // We should always find the EndSubsequence display item. 253 // We should always find the EndSubsequence display item.
254 ASSERT(currentIt != m_currentPaintArtifact.displayItemList().end()); 254 ASSERT(currentIt != m_currentPaintArtifact.displayItemList().end());
255 ASSERT(currentIt->isValid()); 255 ASSERT(currentIt->isValid());
256 updatedList.appendByMoving(*currentIt); 256 updatedList.appendByMoving(*currentIt);
257 ++currentIt; 257 ++currentIt;
258 } while (!endSubsequenceId.matches(updatedList.last())); 258 } while (!endSubsequenceId.matches(updatedList.last()));
259 } 259 }
260 260
261 // Update the existing display items by removing invalidated entries, updating 261 // Update the existing display items by removing invalidated entries, updating
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 #if ENABLE(ASSERT) 355 #if ENABLE(ASSERT)
356 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEn abled()) { 356 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEn abled()) {
357 DisplayItemList::iterator temp = currentIt; 357 DisplayItemList::iterator temp = currentIt;
358 checkUnderInvalidation(newIt, temp); 358 checkUnderInvalidation(newIt, temp);
359 } 359 }
360 #endif 360 #endif
361 if (newDisplayItem.isCachedDrawing()) { 361 if (newDisplayItem.isCachedDrawing()) {
362 updatedList.appendByMoving(*currentIt); 362 updatedList.appendByMoving(*currentIt);
363 ++currentIt; 363 ++currentIt;
364 } else { 364 } else {
365 ASSERT(newDisplayItem.isCachedSubsequence()); 365 ASSERT(newDisplayItem.type() == DisplayItem::CachedSubsequence);
366 copyCachedSubsequence(currentIt, updatedList); 366 copyCachedSubsequence(currentIt, updatedList);
367 ASSERT(updatedList.last().isEndSubsequence()); 367 ASSERT(updatedList.last().type() == DisplayItem::EndSubsequence) ;
368 } 368 }
369 } else { 369 } else {
370 ASSERT(!newDisplayItem.isDrawing() 370 ASSERT(!newDisplayItem.isDrawing()
371 || newDisplayItem.skippedCache() 371 || newDisplayItem.skippedCache()
372 || !clientCacheIsValid(newDisplayItem.client()) 372 || !clientCacheIsValid(newDisplayItem.client())
373 || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client()))); 373 || (RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() && paintOffsetWasInvalidated(newDisplayItem.client())));
374 374
375 updatedList.appendByMoving(*newIt); 375 updatedList.appendByMoving(*newIt);
376 376
377 if (isSynchronized) 377 if (isSynchronized)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // When under-invalidation-checking is enabled, the forced painting is follo wing the cached display item. 451 // When under-invalidation-checking is enabled, the forced painting is follo wing the cached display item.
452 DisplayItem::Type nextItemType = DisplayItem::nonCachedType(newIt->type()); 452 DisplayItem::Type nextItemType = DisplayItem::nonCachedType(newIt->type());
453 ++newIt; 453 ++newIt;
454 ASSERT(newIt->type() == nextItemType); 454 ASSERT(newIt->type() == nextItemType);
455 455
456 if (newIt->isDrawing()) { 456 if (newIt->isDrawing()) {
457 checkCachedDisplayItemIsUnchanged("", *newIt, *currentIt); 457 checkCachedDisplayItemIsUnchanged("", *newIt, *currentIt);
458 return; 458 return;
459 } 459 }
460 460
461 ASSERT(newIt->isSubsequence()); 461 ASSERT(newIt->type() == DisplayItem::Subsequence);
462 462
463 #ifndef NDEBUG 463 #ifndef NDEBUG
464 CString messagePrefix = String::format("(In CachedSubsequence of %s)", newIt ->clientDebugString().utf8().data()).utf8(); 464 CString messagePrefix = String::format("(In CachedSubsequence of %s)", newIt ->clientDebugString().utf8().data()).utf8();
465 #else 465 #else
466 CString messagePrefix = "(In CachedSubsequence)"; 466 CString messagePrefix = "(In CachedSubsequence)";
467 #endif 467 #endif
468 468
469 DisplayItem::Id endSubsequenceId(newIt->client(), DisplayItem::subsequenceTy peToEndSubsequenceType(newIt->type()), 0); 469 DisplayItem::Id endSubsequenceId(newIt->client(), DisplayItem::EndSubsequenc e, 0);
470 while (true) { 470 while (true) {
471 ASSERT(newIt != m_newDisplayItemList.end()); 471 ASSERT(newIt != m_newDisplayItemList.end());
472 if (newIt->isCached()) 472 if (newIt->isCached())
473 checkUnderInvalidation(newIt, currentIt); 473 checkUnderInvalidation(newIt, currentIt);
474 else 474 else
475 checkCachedDisplayItemIsUnchanged(messagePrefix.data(), *newIt, *cur rentIt); 475 checkCachedDisplayItemIsUnchanged(messagePrefix.data(), *newIt, *cur rentIt);
476 476
477 if (endSubsequenceId.matches(*newIt)) 477 if (endSubsequenceId.matches(*newIt))
478 break; 478 break;
479 479
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 void PaintController::showDebugData() const 565 void PaintController::showDebugData() const
566 { 566 {
567 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.displayItemList()).utf8().data()); 567 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.displayItemList()).utf8().data());
568 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); 568 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data());
569 } 569 }
570 570
571 #endif // ifndef NDEBUG 571 #endif // ifndef NDEBUG
572 572
573 } // namespace blink 573 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698