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

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

Issue 2176683003: Use index instead of iterator into DisplayItemList in PaintController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.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 "platform/graphics/paint/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/TraceEvent.h" 7 #include "platform/TraceEvent.h"
8 #include "platform/graphics/GraphicsLayer.h" 8 #include "platform/graphics/GraphicsLayer.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h"
(...skipping 24 matching lines...) Expand all
35 return false; 35 return false;
36 36
37 #if DCHECK_IS_ON() 37 #if DCHECK_IS_ON()
38 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled() && isCheckingUnderInvalidation()) { 38 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled() && isCheckingUnderInvalidation()) {
39 // We are checking under-invalidation of a subsequence enclosing this di splay item. 39 // We are checking under-invalidation of a subsequence enclosing this di splay item.
40 // Let the client continue to actually paint the display item. 40 // Let the client continue to actually paint the display item.
41 return false; 41 return false;
42 } 42 }
43 #endif 43 #endif
44 44
45 DisplayItemList::iterator cachedItem = findCachedItem(DisplayItem::Id(client , type)); 45 size_t cachedItem = findCachedItem(DisplayItem::Id(client, type));
46 if (cachedItem == m_currentPaintArtifact.getDisplayItemList().end()) { 46 if (cachedItem == kNotFound) {
47 NOTREACHED(); 47 NOTREACHED();
48 return false; 48 return false;
49 } 49 }
50 50
51 ++m_numCachedNewItems; 51 ++m_numCachedNewItems;
52 ensureNewDisplayItemListInitialCapacity(); 52 ensureNewDisplayItemListInitialCapacity();
53 if (!DCHECK_IS_ON() || !RuntimeEnabledFeatures::slimmingPaintUnderInvalidati onCheckingEnabled()) 53 if (!DCHECK_IS_ON() || !RuntimeEnabledFeatures::slimmingPaintUnderInvalidati onCheckingEnabled())
54 processNewItem(m_newDisplayItemList.appendByMoving(*cachedItem)); 54 processNewItem(m_newDisplayItemList.appendByMoving(m_currentPaintArtifac t.getDisplayItemList()[cachedItem]));
55 55
56 m_nextItemToMatch = cachedItem + 1; 56 m_nextItemToMatch = cachedItem + 1;
57 // Items before m_nextItemToMatch have been copied so we don't need to index them. 57 // Items before m_nextItemToMatch have been copied so we don't need to index them.
58 if (m_nextItemToMatch - m_nextItemToIndex > 0) 58 if (m_nextItemToMatch > m_nextItemToIndex)
59 m_nextItemToIndex = m_nextItemToMatch; 59 m_nextItemToIndex = m_nextItemToMatch;
60 60
61 #if DCHECK_IS_ON() 61 #if DCHECK_IS_ON()
62 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { 62 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) {
63 if (!isCheckingUnderInvalidation()) { 63 if (!isCheckingUnderInvalidation()) {
64 m_underInvalidationCheckingBegin = cachedItem; 64 m_underInvalidationCheckingBegin = cachedItem;
65 m_underInvalidationCheckingEnd = cachedItem + 1; 65 m_underInvalidationCheckingEnd = cachedItem + 1;
66 m_underInvalidationMessagePrefix = ""; 66 m_underInvalidationMessagePrefix = "";
67 } 67 }
68 // Return false to let the painter actually paint, and we will check if the new painting 68 // Return false to let the painter actually paint, and we will check if the new painting
(...skipping 22 matching lines...) Expand all
91 91
92 #if DCHECK_IS_ON() 92 #if DCHECK_IS_ON()
93 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled() && isCheckingUnderInvalidation()) { 93 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled() && isCheckingUnderInvalidation()) {
94 // We are checking under-invalidation of an ancestor subsequence enclosi ng this one. 94 // We are checking under-invalidation of an ancestor subsequence enclosi ng this one.
95 // The ancestor subsequence is supposed to have already "copied", so we should let the 95 // The ancestor subsequence is supposed to have already "copied", so we should let the
96 // client continue to actually paint the descendant subsequences without "copying". 96 // client continue to actually paint the descendant subsequences without "copying".
97 return false; 97 return false;
98 } 98 }
99 #endif 99 #endif
100 100
101 DisplayItemList::iterator cachedItem = findCachedItem(DisplayItem::Id(client , DisplayItem::Subsequence)); 101 size_t cachedItem = findCachedItem(DisplayItem::Id(client, DisplayItem::Subs equence));
102 if (cachedItem == m_currentPaintArtifact.getDisplayItemList().end()) { 102 if (cachedItem == kNotFound) {
103 NOTREACHED(); 103 NOTREACHED();
104 return false; 104 return false;
105 } 105 }
106 106
107 // |cachedItem| will point to the first item after the subsequence or end of the current list. 107 // |cachedItem| will point to the first item after the subsequence or end of the current list.
108 ensureNewDisplayItemListInitialCapacity(); 108 ensureNewDisplayItemListInitialCapacity();
109 copyCachedSubsequence(cachedItem); 109 copyCachedSubsequence(cachedItem);
110 110
111 m_nextItemToMatch = cachedItem; 111 m_nextItemToMatch = cachedItem;
112 // Items before |cachedItem| have been copied so we don't need to index them . 112 // Items before |cachedItem| have been copied so we don't need to index them .
113 if (cachedItem - m_nextItemToIndex > 0) 113 if (cachedItem > m_nextItemToIndex)
114 m_nextItemToIndex = cachedItem; 114 m_nextItemToIndex = cachedItem;
115 115
116 #if DCHECK_IS_ON() 116 #if DCHECK_IS_ON()
117 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { 117 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) {
118 // Return false to let the painter actually paint, and we will check if the new painting 118 // Return false to let the painter actually paint, and we will check if the new painting
119 // is the same as the cached. 119 // is the same as the cached.
120 return false; 120 return false;
121 } 121 }
122 #endif 122 #endif
123 123
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 { 261 {
262 if (!displayItem.isCacheable()) 262 if (!displayItem.isCacheable())
263 return; 263 return;
264 264
265 DisplayItemIndicesByClientMap::iterator it = displayItemIndicesByClient.find (&displayItem.client()); 265 DisplayItemIndicesByClientMap::iterator it = displayItemIndicesByClient.find (&displayItem.client());
266 Vector<size_t>& indices = it == displayItemIndicesByClient.end() ? 266 Vector<size_t>& indices = it == displayItemIndicesByClient.end() ?
267 displayItemIndicesByClient.add(&displayItem.client(), Vector<size_t>()). storedValue->value : it->value; 267 displayItemIndicesByClient.add(&displayItem.client(), Vector<size_t>()). storedValue->value : it->value;
268 indices.append(index); 268 indices.append(index);
269 } 269 }
270 270
271 DisplayItemList::iterator PaintController::findCachedItem(const DisplayItem::Id& id) 271 size_t PaintController::findCachedItem(const DisplayItem::Id& id)
272 { 272 {
273 DCHECK(clientCacheIsValid(id.client)); 273 DCHECK(clientCacheIsValid(id.client));
274 274
275 // Try to find the item sequentially first. This is fast if the current list and the new list are in 275 // Try to find the item sequentially first. This is fast if the current list and the new list are in
276 // the same order around the new item. If found, we don't need to update and lookup the index. 276 // the same order around the new item. If found, we don't need to update and lookup the index.
277 DisplayItemList::iterator end = m_currentPaintArtifact.getDisplayItemList(). end(); 277 for (size_t i = m_nextItemToMatch; i < m_currentPaintArtifact.getDisplayItem List().size(); ++i) {
278 DisplayItemList::iterator it = m_nextItemToMatch;
279 for (; it != end; ++it) {
280 // We encounter an item that has already been copied which indicates we can't do sequential matching. 278 // We encounter an item that has already been copied which indicates we can't do sequential matching.
281 if (!it->hasValidClient()) 279 const DisplayItem& item = m_currentPaintArtifact.getDisplayItemList()[i] ;
280 if (!item.hasValidClient())
282 break; 281 break;
283 if (id == it->getId()) { 282 if (id == item.getId()) {
284 #if DCHECK_IS_ON() 283 #if DCHECK_IS_ON()
285 ++m_numSequentialMatches; 284 ++m_numSequentialMatches;
286 #endif 285 #endif
287 return it; 286 return i;
288 } 287 }
289 // We encounter a different cacheable item which also indicates we can't do sequential matching. 288 // We encounter a different cacheable item which also indicates we can't do sequential matching.
290 if (it->isCacheable()) 289 if (item.isCacheable())
291 break; 290 break;
292 } 291 }
293 292
294 size_t foundIndex = findMatchingItemFromIndex(id, m_outOfOrderItemIndices, m _currentPaintArtifact.getDisplayItemList()); 293 size_t foundIndex = findMatchingItemFromIndex(id, m_outOfOrderItemIndices, m _currentPaintArtifact.getDisplayItemList());
295 if (foundIndex != kNotFound) { 294 if (foundIndex != kNotFound) {
296 #if DCHECK_IS_ON() 295 #if DCHECK_IS_ON()
297 ++m_numOutOfOrderMatches; 296 ++m_numOutOfOrderMatches;
298 #endif 297 #endif
299 return m_currentPaintArtifact.getDisplayItemList().begin() + foundIndex; 298 return foundIndex;
300 } 299 }
301 300
302 return findOutOfOrderCachedItemForward(id); 301 return findOutOfOrderCachedItemForward(id);
303 } 302 }
304 303
305 // Find forward for the item and index all skipped indexable items. 304 // Find forward for the item and index all skipped indexable items.
306 DisplayItemList::iterator PaintController::findOutOfOrderCachedItemForward(const DisplayItem::Id& id) 305 size_t PaintController::findOutOfOrderCachedItemForward(const DisplayItem::Id& i d)
307 { 306 {
308 DisplayItemList::iterator end = m_currentPaintArtifact.getDisplayItemList(). end(); 307 for (size_t i = m_nextItemToIndex; i < m_currentPaintArtifact.getDisplayItem List().size(); ++i) {
309 for (DisplayItemList::iterator it = m_nextItemToIndex; it != end; ++it) { 308 const DisplayItem& item = m_currentPaintArtifact.getDisplayItemList()[i] ;
310 const DisplayItem& item = *it;
311 DCHECK(item.hasValidClient()); 309 DCHECK(item.hasValidClient());
312 if (id == item.getId()) { 310 if (id == item.getId()) {
313 #if DCHECK_IS_ON() 311 #if DCHECK_IS_ON()
314 ++m_numSequentialMatches; 312 ++m_numSequentialMatches;
315 #endif 313 #endif
316 return it; 314 return i;
317 } 315 }
318 if (item.isCacheable()) { 316 if (item.isCacheable()) {
319 #if DCHECK_IS_ON() 317 #if DCHECK_IS_ON()
320 ++m_numIndexedItems; 318 ++m_numIndexedItems;
321 #endif 319 #endif
322 addItemToIndexIfNeeded(item, it - m_currentPaintArtifact.getDisplayI temList().begin(), m_outOfOrderItemIndices); 320 addItemToIndexIfNeeded(item, i, m_outOfOrderItemIndices);
323 } 321 }
324 } 322 }
325 323
326 #ifndef NDEBUG 324 #ifndef NDEBUG
327 showDebugData(); 325 showDebugData();
328 LOG(ERROR) << id.client.debugName() << ":" << DisplayItem::typeAsDebugString (id.type) << " not found in current display item list"; 326 LOG(ERROR) << id.client.debugName() << ":" << DisplayItem::typeAsDebugString (id.type) << " not found in current display item list";
329 #endif 327 #endif
330 NOTREACHED(); 328 NOTREACHED();
331 // We did not find the cached display item. This should be impossible, but m ay occur if there is a bug 329 // We did not find the cached display item. This should be impossible, but m ay occur if there is a bug
332 // in the system, such as under-invalidation, incorrect cache checking or du plicate display ids. 330 // in the system, such as under-invalidation, incorrect cache checking or du plicate display ids.
333 // In this case, the caller should fall back to repaint the display item. 331 // In this case, the caller should fall back to repaint the display item.
334 return end; 332 return kNotFound;
335 } 333 }
336 334
337 // Copies a cached subsequence from current list to the new list. 335 // Copies a cached subsequence from current list to the new list. On return,
338 // On return, |it| points to the item after the EndSubsequence item of the subse quence. 336 // |cachedItemIndex| points to the item after the EndSubsequence item of the sub sequence.
339 // When paintUnderInvaldiationCheckingEnabled() we'll not actually copy the subs equence, 337 // When paintUnderInvaldiationCheckingEnabled() we'll not actually copy the subs equence,
340 // but mark the begin and end of the subsequence for under-invalidation checking . 338 // but mark the begin and end of the subsequence for under-invalidation checking .
341 void PaintController::copyCachedSubsequence(DisplayItemList::iterator& it) 339 void PaintController::copyCachedSubsequence(size_t& cachedItemIndex)
342 { 340 {
341 DisplayItem* cachedItem = &m_currentPaintArtifact.getDisplayItemList()[cache dItemIndex];
343 #if DCHECK_IS_ON() 342 #if DCHECK_IS_ON()
344 DCHECK(it->getType() == DisplayItem::Subsequence); 343 DCHECK(cachedItem->getType() == DisplayItem::Subsequence);
345 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { 344 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) {
346 DCHECK(!isCheckingUnderInvalidation()); 345 DCHECK(!isCheckingUnderInvalidation());
347 m_underInvalidationCheckingBegin = it; 346 m_underInvalidationCheckingBegin = cachedItemIndex;
348 #ifndef NDEBUG 347 #ifndef NDEBUG
349 m_underInvalidationMessagePrefix = "(In CachedSubsequence of " + it->cli entDebugString() + ")"; 348 m_underInvalidationMessagePrefix = "(In CachedSubsequence of " + cachedI tem->clientDebugString() + ")";
350 #else 349 #else
351 m_underInvalidationMessagePrefix = "(In CachedSubsequence)"; 350 m_underInvalidationMessagePrefix = "(In CachedSubsequence)";
352 #endif 351 #endif
353 } 352 }
354 #endif 353 #endif
355 354
356 DisplayItem::Id endSubsequenceId(it->client(), DisplayItem::EndSubsequence); 355 DisplayItem::Id endSubsequenceId(cachedItem->client(), DisplayItem::EndSubse quence);
357 bool metEndSubsequence = false; 356 while (true) {
358 do { 357 DCHECK(cachedItem->hasValidClient());
359 // We should always find the EndSubsequence display item.
360 DCHECK(it != m_currentPaintArtifact.getDisplayItemList().end());
361 DCHECK(it->hasValidClient());
362 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 358 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
363 CHECK(it->client().isAlive()); 359 CHECK(cachedItem->client().isAlive());
364 #endif 360 #endif
365 ++m_numCachedNewItems; 361 ++m_numCachedNewItems;
366 if (it->getId() == endSubsequenceId) 362 bool metEndSubsequence = cachedItem->getId() == endSubsequenceId;
367 metEndSubsequence = true;
368 if (!DCHECK_IS_ON() || !RuntimeEnabledFeatures::slimmingPaintUnderInvali dationCheckingEnabled()) 363 if (!DCHECK_IS_ON() || !RuntimeEnabledFeatures::slimmingPaintUnderInvali dationCheckingEnabled())
369 processNewItem(m_newDisplayItemList.appendByMoving(*it)); 364 processNewItem(m_newDisplayItemList.appendByMoving(*cachedItem));
370 ++it; 365
371 } while (!metEndSubsequence); 366 ++cachedItemIndex;
367 if (metEndSubsequence)
368 break;
369
370 // We should always be able to find the EndSubsequence display item.
371 DCHECK(cachedItemIndex < m_currentPaintArtifact.getDisplayItemList().siz e());
372 cachedItem = &m_currentPaintArtifact.getDisplayItemList()[cachedItemInde x];
373 }
372 374
373 #if DCHECK_IS_ON() 375 #if DCHECK_IS_ON()
374 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) { 376 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) {
375 m_underInvalidationCheckingEnd = it; 377 m_underInvalidationCheckingEnd = cachedItemIndex;
376 DCHECK(isCheckingUnderInvalidation()); 378 DCHECK(isCheckingUnderInvalidation());
377 } 379 }
378 #endif 380 #endif
379 } 381 }
380 382
381 static IntRect visualRectForDisplayItem(const DisplayItem& displayItem, const La youtSize& offsetFromLayoutObject) 383 static IntRect visualRectForDisplayItem(const DisplayItem& displayItem, const La youtSize& offsetFromLayoutObject)
382 { 384 {
383 LayoutRect visualRect = displayItem.client().visualRect(); 385 LayoutRect visualRect = displayItem.client().visualRect();
384 visualRect.move(-offsetFromLayoutObject); 386 visualRect.move(-offsetFromLayoutObject);
385 return enclosingIntRect(visualRect); 387 return enclosingIntRect(visualRect);
386 } 388 }
387 389
388 void PaintController::resetCurrentListIterators() 390 void PaintController::resetCurrentListIndices()
389 { 391 {
390 m_nextItemToMatch = m_currentPaintArtifact.getDisplayItemList().begin(); 392 m_nextItemToMatch = 0;
391 m_nextItemToIndex = m_nextItemToMatch; 393 m_nextItemToIndex = 0;
392 #if DCHECK_IS_ON() 394 #if DCHECK_IS_ON()
393 m_underInvalidationCheckingBegin = m_currentPaintArtifact.getDisplayItemList ().end(); 395 m_underInvalidationCheckingBegin = 0;
394 m_underInvalidationCheckingEnd = m_currentPaintArtifact.getDisplayItemList() .begin(); 396 m_underInvalidationCheckingEnd = 0;
395 #endif 397 #endif
396 } 398 }
397 399
398 void PaintController::commitNewDisplayItems(const LayoutSize& offsetFromLayoutOb ject) 400 void PaintController::commitNewDisplayItems(const LayoutSize& offsetFromLayoutOb ject)
399 { 401 {
400 TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems", 402 TRACE_EVENT2("blink,benchmark", "PaintController::commitNewDisplayItems",
401 "current_display_list_size", (int)m_currentPaintArtifact.getDisplayItemL ist().size(), 403 "current_display_list_size", (int)m_currentPaintArtifact.getDisplayItemL ist().size(),
402 "num_non_cached_new_items", (int)m_newDisplayItemList.size() - m_numCach edNewItems); 404 "num_non_cached_new_items", (int)m_newDisplayItemList.size() - m_numCach edNewItems);
403 m_numCachedNewItems = 0; 405 m_numCachedNewItems = 0;
404 406
(...skipping 13 matching lines...) Expand all
418 420
419 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item, off setFromLayoutObject)); 421 m_newDisplayItemList.appendVisualRect(visualRectForDisplayItem(item, off setFromLayoutObject));
420 422
421 if (item.isCacheable()) 423 if (item.isCacheable())
422 item.client().setDisplayItemsCached(m_currentCacheGeneration); 424 item.client().setDisplayItemsCached(m_currentCacheGeneration);
423 } 425 }
424 426
425 // The new list will not be appended to again so we can release unused memor y. 427 // The new list will not be appended to again so we can release unused memor y.
426 m_newDisplayItemList.shrinkToFit(); 428 m_newDisplayItemList.shrinkToFit();
427 m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList), m_ne wPaintChunks.releasePaintChunks(), gpuAnalyzer.suitableForGpuRasterization()); 429 m_currentPaintArtifact = PaintArtifact(std::move(m_newDisplayItemList), m_ne wPaintChunks.releasePaintChunks(), gpuAnalyzer.suitableForGpuRasterization());
428 resetCurrentListIterators(); 430 resetCurrentListIndices();
429 m_outOfOrderItemIndices.clear(); 431 m_outOfOrderItemIndices.clear();
430 432
431 // We'll allocate the initial buffer when we start the next paint. 433 // We'll allocate the initial buffer when we start the next paint.
432 m_newDisplayItemList = DisplayItemList(0); 434 m_newDisplayItemList = DisplayItemList(0);
433 435
434 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS 436 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS
435 CHECK(m_currentSubsequenceClients.isEmpty()); 437 CHECK(m_currentSubsequenceClients.isEmpty());
436 DisplayItemClient::endShouldKeepAliveAllClients(this); 438 DisplayItemClient::endShouldKeepAliveAllClients(this);
437 #endif 439 #endif
438 440
(...skipping 28 matching lines...) Expand all
467 469
468 return memoryUsage; 470 return memoryUsage;
469 } 471 }
470 472
471 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject) 473 void PaintController::appendDebugDrawingAfterCommit(const DisplayItemClient& dis playItemClient, PassRefPtr<SkPicture> picture, const LayoutSize& offsetFromLayou tObject)
472 { 474 {
473 DCHECK(m_newDisplayItemList.isEmpty()); 475 DCHECK(m_newDisplayItemList.isEmpty());
474 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture); 476 DrawingDisplayItem& displayItem = m_currentPaintArtifact.getDisplayItemList( ).allocateAndConstruct<DrawingDisplayItem>(displayItemClient, DisplayItem::Debug Drawing, picture);
475 displayItem.setSkippedCache(); 477 displayItem.setSkippedCache();
476 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject)); 478 m_currentPaintArtifact.getDisplayItemList().appendVisualRect(visualRectForDi splayItem(displayItem, offsetFromLayoutObject));
477
478 // Need to reset the iterators after mutation of the DisplayItemList.
479 resetCurrentListIterators();
480 } 479 }
481 480
482 #if DCHECK_IS_ON() 481 #if DCHECK_IS_ON()
483 482
484 void PaintController::showUnderInvalidationError(const char* reason, const Displ ayItem& newItem, const DisplayItem& oldItem) const 483 void PaintController::showUnderInvalidationError(const char* reason, const Displ ayItem& newItem, const DisplayItem& oldItem) const
485 { 484 {
486 LOG(ERROR) << m_underInvalidationMessagePrefix << " " << reason; 485 LOG(ERROR) << m_underInvalidationMessagePrefix << " " << reason;
487 #ifndef NDEBUG 486 #ifndef NDEBUG
488 LOG(ERROR) << "New display item: " << newItem.asDebugString(); 487 LOG(ERROR) << "New display item: " << newItem.asDebugString();
489 LOG(ERROR) << "Old display item: " << oldItem.asDebugString(); 488 LOG(ERROR) << "Old display item: " << oldItem.asDebugString();
(...skipping 13 matching lines...) Expand all
503 } 502 }
504 503
505 void PaintController::checkUnderInvalidation() 504 void PaintController::checkUnderInvalidation()
506 { 505 {
507 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ()); 506 DCHECK(RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled ());
508 507
509 if (!isCheckingUnderInvalidation()) 508 if (!isCheckingUnderInvalidation())
510 return; 509 return;
511 510
512 const DisplayItem& newItem = m_newDisplayItemList.last(); 511 const DisplayItem& newItem = m_newDisplayItemList.last();
513 const DisplayItem& oldItem = *m_underInvalidationCheckingBegin++; 512 const DisplayItem& oldItem = m_currentPaintArtifact.getDisplayItemList()[m_u nderInvalidationCheckingBegin++];
514 513
515 if (newItem.isCacheable() && !clientCacheIsValid(newItem.client())) { 514 if (newItem.isCacheable() && !clientCacheIsValid(newItem.client())) {
516 showUnderInvalidationError("under-invalidation of PaintLayer: invalidate d in cached subsequence", newItem, oldItem); 515 showUnderInvalidationError("under-invalidation of PaintLayer: invalidate d in cached subsequence", newItem, oldItem);
517 NOTREACHED(); 516 NOTREACHED();
518 } 517 }
519 if (!newItem.equals(oldItem)) { 518 if (!newItem.equals(oldItem)) {
520 showUnderInvalidationError("under-invalidation: display item changed", n ewItem, oldItem); 519 showUnderInvalidationError("under-invalidation: display item changed", n ewItem, oldItem);
521 NOTREACHED(); 520 NOTREACHED();
522 } 521 }
523 } 522 }
(...skipping 29 matching lines...) Expand all
553 552
554 void PaintController::showDebugData() const 553 void PaintController::showDebugData() const
555 { 554 {
556 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); 555 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data());
557 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data()); 556 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m _newDisplayItemList).utf8().data());
558 } 557 }
559 558
560 #endif // ifndef NDEBUG 559 #endif // ifndef NDEBUG
561 560
562 } // namespace blink 561 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PaintController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698