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

Side by Side Diff: third_party/WebKit/Source/platform/testing/TestPaintArtifact.cpp

Issue 2615813003: Migrate WTF::Vector::append() to ::push_back() [part 14 of N] (Closed)
Patch Set: rebase, small fix in FontSettings.h Created 3 years, 11 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/testing/TestPaintArtifact.h" 5 #include "platform/testing/TestPaintArtifact.h"
6 6
7 #include "cc/layers/layer.h" 7 #include "cc/layers/layer.h"
8 #include "platform/graphics/paint/DisplayItemClient.h" 8 #include "platform/graphics/paint/DisplayItemClient.h"
9 #include "platform/graphics/paint/DrawingDisplayItem.h" 9 #include "platform/graphics/paint/DrawingDisplayItem.h"
10 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" 10 #include "platform/graphics/paint/ForeignLayerDisplayItem.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 return chunk(properties); 58 return chunk(properties);
59 } 59 }
60 60
61 TestPaintArtifact& TestPaintArtifact::chunk( 61 TestPaintArtifact& TestPaintArtifact::chunk(
62 const PaintChunkProperties& properties) { 62 const PaintChunkProperties& properties) {
63 if (!m_paintChunks.isEmpty()) 63 if (!m_paintChunks.isEmpty())
64 m_paintChunks.back().endIndex = m_displayItemList.size(); 64 m_paintChunks.back().endIndex = m_displayItemList.size();
65 PaintChunk chunk; 65 PaintChunk chunk;
66 chunk.beginIndex = m_displayItemList.size(); 66 chunk.beginIndex = m_displayItemList.size();
67 chunk.properties = properties; 67 chunk.properties = properties;
68 m_paintChunks.append(chunk); 68 m_paintChunks.push_back(chunk);
69 return *this; 69 return *this;
70 } 70 }
71 71
72 TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds, 72 TestPaintArtifact& TestPaintArtifact::rectDrawing(const FloatRect& bounds,
73 Color color) { 73 Color color) {
74 std::unique_ptr<DummyRectClient> client = 74 std::unique_ptr<DummyRectClient> client =
75 WTF::makeUnique<DummyRectClient>(bounds, color); 75 WTF::makeUnique<DummyRectClient>(bounds, color);
76 m_displayItemList.allocateAndConstruct<DrawingDisplayItem>( 76 m_displayItemList.allocateAndConstruct<DrawingDisplayItem>(
77 *client, DisplayItem::kDrawingFirst, client->makePicture()); 77 *client, DisplayItem::kDrawingFirst, client->makePicture());
78 m_dummyClients.append(std::move(client)); 78 m_dummyClients.push_back(std::move(client));
79 return *this; 79 return *this;
80 } 80 }
81 81
82 TestPaintArtifact& TestPaintArtifact::foreignLayer( 82 TestPaintArtifact& TestPaintArtifact::foreignLayer(
83 const FloatPoint& location, 83 const FloatPoint& location,
84 const IntSize& size, 84 const IntSize& size,
85 scoped_refptr<cc::Layer> layer) { 85 scoped_refptr<cc::Layer> layer) {
86 FloatRect floatBounds(location, FloatSize(size)); 86 FloatRect floatBounds(location, FloatSize(size));
87 std::unique_ptr<DummyRectClient> client = 87 std::unique_ptr<DummyRectClient> client =
88 WTF::wrapUnique(new DummyRectClient(floatBounds, Color::transparent)); 88 WTF::wrapUnique(new DummyRectClient(floatBounds, Color::transparent));
89 m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>( 89 m_displayItemList.allocateAndConstruct<ForeignLayerDisplayItem>(
90 *client, DisplayItem::kForeignLayerFirst, std::move(layer), location, 90 *client, DisplayItem::kForeignLayerFirst, std::move(layer), location,
91 size); 91 size);
92 m_dummyClients.append(std::move(client)); 92 m_dummyClients.push_back(std::move(client));
93 return *this; 93 return *this;
94 } 94 }
95 95
96 const PaintArtifact& TestPaintArtifact::build() { 96 const PaintArtifact& TestPaintArtifact::build() {
97 if (m_built) 97 if (m_built)
98 return m_paintArtifact; 98 return m_paintArtifact;
99 99
100 if (!m_paintChunks.isEmpty()) 100 if (!m_paintChunks.isEmpty())
101 m_paintChunks.back().endIndex = m_displayItemList.size(); 101 m_paintChunks.back().endIndex = m_displayItemList.size();
102 m_paintArtifact = PaintArtifact(std::move(m_displayItemList), 102 m_paintArtifact = PaintArtifact(std::move(m_displayItemList),
103 std::move(m_paintChunks), true); 103 std::move(m_paintChunks), true);
104 m_built = true; 104 m_built = true;
105 return m_paintArtifact; 105 return m_paintArtifact;
106 } 106 }
107 107
108 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698