| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/PaintArtifact.h" | 5 #include "platform/graphics/paint/PaintArtifact.h" |
| 6 | 6 |
| 7 #include "platform/TraceEvent.h" | 7 #include "platform/TraceEvent.h" |
| 8 #include "platform/geometry/IntRect.h" | 8 #include "platform/geometry/IntRect.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) | 72 PaintArtifact& PaintArtifact::operator=(PaintArtifact&& source) |
| 73 { | 73 { |
| 74 m_displayItemList = std::move(source.m_displayItemList); | 74 m_displayItemList = std::move(source.m_displayItemList); |
| 75 m_paintChunks = std::move(source.m_paintChunks); | 75 m_paintChunks = std::move(source.m_paintChunks); |
| 76 m_isSuitableForGpuRasterization = source.m_isSuitableForGpuRasterization; | 76 m_isSuitableForGpuRasterization = source.m_isSuitableForGpuRasterization; |
| 77 return *this; | 77 return *this; |
| 78 } | 78 } |
| 79 | 79 |
| 80 static bool compareChunkAndIndex(const PaintChunk& chunk, size_t index) | |
| 81 { | |
| 82 return chunk.endIndex <= index; | |
| 83 } | |
| 84 | |
| 85 Vector<PaintChunk>::const_iterator PaintArtifact::findChunkByDisplayItemIndex(si
ze_t index) const | |
| 86 { | |
| 87 auto chunkIt = std::lower_bound(m_paintChunks.begin(), m_paintChunks.end(),
index, compareChunkAndIndex); | |
| 88 DCHECK(chunkIt != m_paintChunks.end()); | |
| 89 DCHECK(index >= chunkIt->beginIndex); | |
| 90 DCHECK(index < chunkIt->endIndex); | |
| 91 return chunkIt; | |
| 92 } | |
| 93 | |
| 94 void PaintArtifact::reset() | 80 void PaintArtifact::reset() |
| 95 { | 81 { |
| 96 m_displayItemList.clear(); | 82 m_displayItemList.clear(); |
| 97 m_paintChunks.clear(); | 83 m_paintChunks.clear(); |
| 98 } | 84 } |
| 99 | 85 |
| 100 size_t PaintArtifact::approximateUnsharedMemoryUsage() const | 86 size_t PaintArtifact::approximateUnsharedMemoryUsage() const |
| 101 { | 87 { |
| 102 return sizeof(*this) + m_displayItemList.memoryUsageInBytes() | 88 return sizeof(*this) + m_displayItemList.memoryUsageInBytes() |
| 103 + m_paintChunks.capacity() * sizeof(m_paintChunks[0]); | 89 + m_paintChunks.capacity() * sizeof(m_paintChunks[0]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 115 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList")
; | 101 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList")
; |
| 116 size_t visualRectIndex = 0; | 102 size_t visualRectIndex = 0; |
| 117 for (const DisplayItem& displayItem : m_displayItemList) { | 103 for (const DisplayItem& displayItem : m_displayItemList) { |
| 118 displayItem.appendToWebDisplayItemList(m_displayItemList.visualRect(visu
alRectIndex), list); | 104 displayItem.appendToWebDisplayItemList(m_displayItemList.visualRect(visu
alRectIndex), list); |
| 119 visualRectIndex++; | 105 visualRectIndex++; |
| 120 } | 106 } |
| 121 list->setIsSuitableForGpuRasterization(isSuitableForGpuRasterization()); | 107 list->setIsSuitableForGpuRasterization(isSuitableForGpuRasterization()); |
| 122 } | 108 } |
| 123 | 109 |
| 124 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |