| OLD | NEW |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 void PaintController::copyCachedSubsequence(const DisplayItemList& currentList,
DisplayItemList::iterator& currentIt, DisplayItemList& updatedList, SkPictureGpu
Analyzer& gpuAnalyzer) | 195 void PaintController::copyCachedSubsequence(const DisplayItemList& currentList,
DisplayItemList::iterator& currentIt, DisplayItemList& updatedList, SkPictureGpu
Analyzer& gpuAnalyzer) |
| 196 { | 196 { |
| 197 DCHECK(currentIt->getType() == DisplayItem::Subsequence); | 197 DCHECK(currentIt->getType() == DisplayItem::Subsequence); |
| 198 DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::EndSubseq
uence); | 198 DisplayItem::Id endSubsequenceId(currentIt->client(), DisplayItem::EndSubseq
uence); |
| 199 do { | 199 do { |
| 200 // We should always find the EndSubsequence display item. | 200 // We should always find the EndSubsequence display item. |
| 201 DCHECK(currentIt != m_currentPaintArtifact.getDisplayItemList().end()); | 201 DCHECK(currentIt != m_currentPaintArtifact.getDisplayItemList().end()); |
| 202 DCHECK(currentIt->hasValidClient()); | 202 DCHECK(currentIt->hasValidClient()); |
| 203 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS | 203 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 204 CHECK(currentIt->client().isAlive()); | 204 CHECK(clientCacheIsValid(currentIt->client()) || !currentIt->isCacheable
()); |
| 205 #endif | 205 #endif |
| 206 updatedList.appendByMoving(*currentIt, currentList.visualRect(currentIt
- m_currentPaintArtifact.getDisplayItemList().begin()), gpuAnalyzer); | 206 updatedList.appendByMoving(*currentIt, currentList.visualRect(currentIt
- m_currentPaintArtifact.getDisplayItemList().begin()), gpuAnalyzer); |
| 207 ++currentIt; | 207 ++currentIt; |
| 208 } while (!endSubsequenceId.matches(updatedList.last())); | 208 } while (!endSubsequenceId.matches(updatedList.last())); |
| 209 } | 209 } |
| 210 | 210 |
| 211 static IntRect visualRectForDisplayItem(const DisplayItem& displayItem, const La
youtSize& offsetFromLayoutObject) | 211 static IntRect visualRectForDisplayItem(const DisplayItem& displayItem, const La
youtSize& offsetFromLayoutObject) |
| 212 { | 212 { |
| 213 LayoutRect visualRect = displayItem.client().visualRect(); | 213 LayoutRect visualRect = displayItem.client().visualRect(); |
| 214 visualRect.move(-offsetFromLayoutObject); | 214 visualRect.move(-offsetFromLayoutObject); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.getDisplayItem
List().end(); | 273 DisplayItemList::iterator currentEnd = m_currentPaintArtifact.getDisplayItem
List().end(); |
| 274 for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt !
= m_newDisplayItemList.end(); ++newIt) { | 274 for (DisplayItemList::iterator newIt = m_newDisplayItemList.begin(); newIt !
= m_newDisplayItemList.end(); ++newIt) { |
| 275 const DisplayItem& newDisplayItem = *newIt; | 275 const DisplayItem& newDisplayItem = *newIt; |
| 276 const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); | 276 const DisplayItem::Id newDisplayItemId = newDisplayItem.nonCachedId(); |
| 277 bool newDisplayItemHasCachedType = newDisplayItem.getType() != newDispla
yItemId.type; | 277 bool newDisplayItemHasCachedType = newDisplayItem.getType() != newDispla
yItemId.type; |
| 278 | 278 |
| 279 bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matche
s(*currentIt); | 279 bool isSynchronized = currentIt != currentEnd && newDisplayItemId.matche
s(*currentIt); |
| 280 | 280 |
| 281 if (newDisplayItemHasCachedType) { | 281 if (newDisplayItemHasCachedType) { |
| 282 DCHECK(newDisplayItem.isCached()); | 282 DCHECK(newDisplayItem.isCached()); |
| 283 DCHECK(clientCacheIsValid(newDisplayItem.client())); | 283 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 284 CHECK(clientCacheIsValid(newDisplayItem.client())); |
| 285 #endif |
| 284 if (!isSynchronized) { | 286 if (!isSynchronized) { |
| 285 currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrde
rIndexContext); | 287 currentIt = findOutOfOrderCachedItem(newDisplayItemId, outOfOrde
rIndexContext); |
| 286 | 288 |
| 287 if (currentIt == currentEnd) { | 289 if (currentIt == currentEnd) { |
| 288 #ifndef NDEBUG | 290 #ifndef NDEBUG |
| 289 showDebugData(); | 291 showDebugData(); |
| 290 WTFLogAlways("%s not found in m_currentDisplayItemList\n", n
ewDisplayItem.asDebugString().utf8().data()); | 292 WTFLogAlways("%s not found in m_currentDisplayItemList\n", n
ewDisplayItem.asDebugString().utf8().data()); |
| 291 #endif | 293 #endif |
| 292 NOTREACHED(); | 294 NOTREACHED(); |
| 293 // We did not find the cached display item. This should be i
mpossible, but may occur if there is a bug | 295 // We did not find the cached display item. This should be i
mpossible, but may occur if there is a bug |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 | 494 |
| 493 void PaintController::showDebugData() const | 495 void PaintController::showDebugData() const |
| 494 { | 496 { |
| 495 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); | 497 WTFLogAlways("current display item list: [%s]\n", displayItemListAsDebugStri
ng(m_currentPaintArtifact.getDisplayItemList()).utf8().data()); |
| 496 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); | 498 WTFLogAlways("new display item list: [%s]\n", displayItemListAsDebugString(m
_newDisplayItemList).utf8().data()); |
| 497 } | 499 } |
| 498 | 500 |
| 499 #endif // ifndef NDEBUG | 501 #endif // ifndef NDEBUG |
| 500 | 502 |
| 501 } // namespace blink | 503 } // namespace blink |
| OLD | NEW |