| Index: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..04d5ebdb1a386eeb486970471ccc9344fe8afcb9
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "platform/graphics/paint/PaintArtifact.h"
|
| +
|
| +#include "platform/TraceEvent.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PaintArtifact::PaintArtifact()
|
| + : m_displayItems(0)
|
| +{
|
| +}
|
| +
|
| +PaintArtifact::~PaintArtifact()
|
| +{
|
| +}
|
| +
|
| +void PaintArtifact::reset()
|
| +{
|
| + m_displayItems.clear();
|
| + m_paintChunks.clear();
|
| +}
|
| +
|
| +void PaintArtifact::update(DisplayItems& updatedDisplayItems, Vector<PaintChunk> updatedPaintChunks)
|
| +{
|
| + // TODO(jbroman): This can be expressed more clearly once std::move is
|
| + // available.
|
| + m_displayItems.clear();
|
| + m_displayItems.swap(updatedDisplayItems);
|
| + m_paintChunks.swap(updatedPaintChunks);
|
| +}
|
| +
|
| +size_t PaintArtifact::approximateUnsharedMemoryUsage() const
|
| +{
|
| + return sizeof(*this) + m_displayItems.memoryUsageInBytes()
|
| + + m_paintChunks.capacity() * sizeof(m_paintChunks[0]);
|
| +}
|
| +
|
| +void PaintArtifact::replay(GraphicsContext& graphicsContext) const
|
| +{
|
| + TRACE_EVENT0("blink,benchmark", "PaintArtifact::replay");
|
| + for (const DisplayItem& displayItem : m_displayItems)
|
| + displayItem.replay(graphicsContext);
|
| +}
|
| +
|
| +void PaintArtifact::appendToWebDisplayItemList(WebDisplayItemList* list) const
|
| +{
|
| + TRACE_EVENT0("blink,benchmark", "PaintArtifact::appendToWebDisplayItemList");
|
| + for (const DisplayItem& displayItem : m_displayItems)
|
| + displayItem.appendToWebDisplayItemList(list);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|