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, unsigned index) | |
pdr.
2016/07/26 16:54:21
Should all of these unsigned be size_t (here, and
Xianzhu
2016/07/26 17:01:43
Do you know what was the reason that we chose unsi
| |
81 { | |
82 return chunk.endIndex <= index; | |
83 } | |
84 | |
85 Vector<PaintChunk>::const_iterator PaintArtifact::findChunkByDisplayItemIndex(un signed 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 | |
80 void PaintArtifact::reset() | 94 void PaintArtifact::reset() |
81 { | 95 { |
82 m_displayItemList.clear(); | 96 m_displayItemList.clear(); |
83 m_paintChunks.clear(); | 97 m_paintChunks.clear(); |
84 } | 98 } |
85 | 99 |
86 size_t PaintArtifact::approximateUnsharedMemoryUsage() const | 100 size_t PaintArtifact::approximateUnsharedMemoryUsage() const |
87 { | 101 { |
88 return sizeof(*this) + m_displayItemList.memoryUsageInBytes() | 102 return sizeof(*this) + m_displayItemList.memoryUsageInBytes() |
89 + m_paintChunks.capacity() * sizeof(m_paintChunks[0]); | 103 + m_paintChunks.capacity() * sizeof(m_paintChunks[0]); |
(...skipping 11 matching lines...) Expand all Loading... | |
101 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList") ; | 115 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList") ; |
102 unsigned visualRectIndex = 0; | 116 unsigned visualRectIndex = 0; |
103 for (const DisplayItem& displayItem : m_displayItemList) { | 117 for (const DisplayItem& displayItem : m_displayItemList) { |
104 displayItem.appendToWebDisplayItemList(m_displayItemList.visualRect(visu alRectIndex), list); | 118 displayItem.appendToWebDisplayItemList(m_displayItemList.visualRect(visu alRectIndex), list); |
105 visualRectIndex++; | 119 visualRectIndex++; |
106 } | 120 } |
107 list->setIsSuitableForGpuRasterization(isSuitableForGpuRasterization()); | 121 list->setIsSuitableForGpuRasterization(isSuitableForGpuRasterization()); |
108 } | 122 } |
109 | 123 |
110 } // namespace blink | 124 } // namespace blink |
OLD | NEW |