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

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

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/PaintController.h" 5 #include "platform/graphics/paint/PaintController.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/paint/CachedDisplayItem.h" 9 #include "platform/graphics/paint/CachedDisplayItem.h"
10 #include "platform/graphics/paint/ClipPathDisplayItem.h" 10 #include "platform/graphics/paint/ClipPathDisplayItem.h"
11 #include "platform/graphics/paint/ClipPathRecorder.h" 11 #include "platform/graphics/paint/ClipPathRecorder.h"
12 #include "platform/graphics/paint/ClipRecorder.h" 12 #include "platform/graphics/paint/ClipRecorder.h"
13 #include "platform/graphics/paint/DrawingDisplayItem.h" 13 #include "platform/graphics/paint/DrawingDisplayItem.h"
14 #include "platform/graphics/paint/DrawingRecorder.h" 14 #include "platform/graphics/paint/DrawingRecorder.h"
15 #include "platform/graphics/paint/SubsequenceRecorder.h" 15 #include "platform/graphics/paint/SubsequenceRecorder.h"
16 #include "platform/testing/FakeDisplayItemClient.h" 16 #include "platform/testing/FakeDisplayItemClient.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include <memory>
18 19
19 namespace blink { 20 namespace blink {
20 21
21 class PaintControllerTest : public ::testing::Test { 22 class PaintControllerTest : public ::testing::Test {
22 public: 23 public:
23 PaintControllerTest() 24 PaintControllerTest()
24 : m_paintController(PaintController::create()) 25 : m_paintController(PaintController::create())
25 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled()) { } 26 , m_originalSlimmingPaintV2Enabled(RuntimeEnabledFeatures::slimmingPaint V2Enabled()) { }
26 27
27 IntRect visualRect(const PaintArtifact& paintArtifact, unsigned index) 28 IntRect visualRect(const PaintArtifact& paintArtifact, unsigned index)
28 { 29 {
29 return paintArtifact.getDisplayItemList().visualRect(index); 30 return paintArtifact.getDisplayItemList().visualRect(index);
30 } 31 }
31 32
32 protected: 33 protected:
33 PaintController& getPaintController() { return *m_paintController; } 34 PaintController& getPaintController() { return *m_paintController; }
34 35
35 private: 36 private:
36 void TearDown() override 37 void TearDown() override
37 { 38 {
38 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled); 39 RuntimeEnabledFeatures::setSlimmingPaintV2Enabled(m_originalSlimmingPain tV2Enabled);
39 } 40 }
40 41
41 OwnPtr<PaintController> m_paintController; 42 std::unique_ptr<PaintController> m_paintController;
42 bool m_originalSlimmingPaintV2Enabled; 43 bool m_originalSlimmingPaintV2Enabled;
43 }; 44 };
44 45
45 const DisplayItem::Type foregroundDrawingType = static_cast<DisplayItem::Type>(D isplayItem::DrawingPaintPhaseFirst + 4); 46 const DisplayItem::Type foregroundDrawingType = static_cast<DisplayItem::Type>(D isplayItem::DrawingPaintPhaseFirst + 4);
46 const DisplayItem::Type backgroundDrawingType = DisplayItem::DrawingPaintPhaseFi rst; 47 const DisplayItem::Type backgroundDrawingType = DisplayItem::DrawingPaintPhaseFi rst;
47 const DisplayItem::Type clipType = DisplayItem::ClipFirst; 48 const DisplayItem::Type clipType = DisplayItem::ClipFirst;
48 49
49 class TestDisplayItem final : public DisplayItem { 50 class TestDisplayItem final : public DisplayItem {
50 public: 51 public:
51 TestDisplayItem(const FakeDisplayItemClient& client, Type type) : DisplayIte m(client, type, sizeof(*this)) { } 52 TestDisplayItem(const FakeDisplayItemClient& client, Type type) : DisplayIte m(client, type, sizeof(*this)) { }
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 getPaintController().createAndAppend<BeginClipPathDisplayItem>(clien t, path); 926 getPaintController().createAndAppend<BeginClipPathDisplayItem>(clien t, path);
926 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 10 0)); 927 drawRect(context, client, backgroundDrawingType, FloatRect(0, 0, 100, 10 0));
927 for (int j = 0; j < 50; ++j) 928 for (int j = 0; j < 50; ++j)
928 getPaintController().createAndAppend<EndClipPathDisplayItem>(client) ; 929 getPaintController().createAndAppend<EndClipPathDisplayItem>(client) ;
929 getPaintController().commitNewDisplayItems(LayoutSize()); 930 getPaintController().commitNewDisplayItems(LayoutSize());
930 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRaster ization()); 931 EXPECT_FALSE(getPaintController().paintArtifact().isSuitableForGpuRaster ization());
931 } 932 }
932 } 933 }
933 934
934 } // namespace blink 935 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698