| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "platform/graphics/paint/PaintArtifact.h" |
| 7 |
| 8 #include "platform/TraceEvent.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 PaintArtifact::PaintArtifact() |
| 13 : m_displayItems(0) |
| 14 { |
| 15 } |
| 16 |
| 17 PaintArtifact::~PaintArtifact() |
| 18 { |
| 19 } |
| 20 |
| 21 void PaintArtifact::reset() |
| 22 { |
| 23 m_displayItems.clear(); |
| 24 m_paintChunks.clear(); |
| 25 } |
| 26 |
| 27 void PaintArtifact::update(DisplayItems& updatedDisplayItems, Vector<PaintChunk>
updatedPaintChunks) |
| 28 { |
| 29 // TODO(jbroman): This can be expressed more clearly once std::move is |
| 30 // available. |
| 31 m_displayItems.clear(); |
| 32 m_displayItems.swap(updatedDisplayItems); |
| 33 m_paintChunks.swap(updatedPaintChunks); |
| 34 } |
| 35 |
| 36 size_t PaintArtifact::approximateUnsharedMemoryUsage() const |
| 37 { |
| 38 return sizeof(*this) + m_displayItems.memoryUsageInBytes() |
| 39 + m_paintChunks.capacity() * sizeof(m_paintChunks[0]); |
| 40 } |
| 41 |
| 42 void PaintArtifact::replay(GraphicsContext& graphicsContext) const |
| 43 { |
| 44 TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay"); |
| 45 for (const DisplayItem& displayItem : m_displayItems) |
| 46 displayItem.replay(graphicsContext); |
| 47 } |
| 48 |
| 49 void PaintArtifact::appendToWebDisplayItemList(WebDisplayItemList* list) const |
| 50 { |
| 51 TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList")
; |
| 52 for (const DisplayItem& displayItem : m_displayItems) |
| 53 displayItem.appendToWebDisplayItemList(list); |
| 54 } |
| 55 |
| 56 } // namespace blink |
| OLD | NEW |