Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintArtifact.cpp

Issue 1396783003: Factor PaintArtifact out of DisplayItemList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@const-replay
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698