| 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/graphics/GraphicsLayer.h" | 7 #include "platform/graphics/GraphicsLayer.h" |
| 8 #include "platform/graphics/paint/DrawingDisplayItem.h" | 8 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 9 #include "platform/instrumentation/tracing/TraceEvent.h" | 9 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" | 10 #include "third_party/skia/include/core/SkPictureAnalyzer.h" |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 size_t index, | 306 size_t index, |
| 307 IndicesByClientMap& displayItemIndicesByClient) { | 307 IndicesByClientMap& displayItemIndicesByClient) { |
| 308 if (!displayItem.isCacheable()) | 308 if (!displayItem.isCacheable()) |
| 309 return; | 309 return; |
| 310 | 310 |
| 311 IndicesByClientMap::iterator it = | 311 IndicesByClientMap::iterator it = |
| 312 displayItemIndicesByClient.find(&displayItem.client()); | 312 displayItemIndicesByClient.find(&displayItem.client()); |
| 313 Vector<size_t>& indices = | 313 Vector<size_t>& indices = |
| 314 it == displayItemIndicesByClient.end() | 314 it == displayItemIndicesByClient.end() |
| 315 ? displayItemIndicesByClient | 315 ? displayItemIndicesByClient |
| 316 .add(&displayItem.client(), Vector<size_t>()) | 316 .insert(&displayItem.client(), Vector<size_t>()) |
| 317 .storedValue->value | 317 .storedValue->value |
| 318 : it->value; | 318 : it->value; |
| 319 indices.push_back(index); | 319 indices.push_back(index); |
| 320 } | 320 } |
| 321 | 321 |
| 322 size_t PaintController::findCachedItem(const DisplayItem::Id& id) { | 322 size_t PaintController::findCachedItem(const DisplayItem::Id& id) { |
| 323 DCHECK(clientCacheIsValid(id.client)); | 323 DCHECK(clientCacheIsValid(id.client)); |
| 324 | 324 |
| 325 // Try to find the item sequentially first. This is fast if the current list | 325 // Try to find the item sequentially first. This is fast if the current list |
| 326 // and the new list are in the same order around the new item. If found, we | 326 // and the new list are in the same order around the new item. If found, we |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 ++m_nextChunkToMatch; | 639 ++m_nextChunkToMatch; |
| 640 return; | 640 return; |
| 641 } | 641 } |
| 642 | 642 |
| 643 // Add skipped old chunks into the index. | 643 // Add skipped old chunks into the index. |
| 644 if (oldChunk.id) { | 644 if (oldChunk.id) { |
| 645 auto it = m_outOfOrderChunkIndices.find(&oldChunk.id->client); | 645 auto it = m_outOfOrderChunkIndices.find(&oldChunk.id->client); |
| 646 Vector<size_t>& indices = | 646 Vector<size_t>& indices = |
| 647 it == m_outOfOrderChunkIndices.end() | 647 it == m_outOfOrderChunkIndices.end() |
| 648 ? m_outOfOrderChunkIndices | 648 ? m_outOfOrderChunkIndices |
| 649 .add(&oldChunk.id->client, Vector<size_t>()) | 649 .insert(&oldChunk.id->client, Vector<size_t>()) |
| 650 .storedValue->value | 650 .storedValue->value |
| 651 : it->value; | 651 : it->value; |
| 652 indices.push_back(m_nextChunkToMatch); | 652 indices.push_back(m_nextChunkToMatch); |
| 653 } | 653 } |
| 654 ++m_nextChunkToMatch; | 654 ++m_nextChunkToMatch; |
| 655 } | 655 } |
| 656 | 656 |
| 657 // Sequential matching reaches the end. Find from the out-of-order index. | 657 // Sequential matching reaches the end. Find from the out-of-order index. |
| 658 auto it = m_outOfOrderChunkIndices.find(&newChunk.id->client); | 658 auto it = m_outOfOrderChunkIndices.find(&newChunk.id->client); |
| 659 if (it != m_outOfOrderChunkIndices.end()) { | 659 if (it != m_outOfOrderChunkIndices.end()) { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 0, m_newDisplayItemList.size(), | 861 0, m_newDisplayItemList.size(), |
| 862 showPictures ? (DisplayItemList::JsonOptions::ShowPictures | | 862 showPictures ? (DisplayItemList::JsonOptions::ShowPictures | |
| 863 DisplayItemList::JsonOptions::ShowClientDebugName) | 863 DisplayItemList::JsonOptions::ShowClientDebugName) |
| 864 : DisplayItemList::JsonOptions::ShowClientDebugName) | 864 : DisplayItemList::JsonOptions::ShowClientDebugName) |
| 865 ->toPrettyJSONString() | 865 ->toPrettyJSONString() |
| 866 .utf8() | 866 .utf8() |
| 867 .data()); | 867 .data()); |
| 868 } | 868 } |
| 869 | 869 |
| 870 } // namespace blink | 870 } // namespace blink |
| OLD | NEW |