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

Side by Side Diff: cc/trees/layer_tree_host_unittest_scroll.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase Created 4 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
(...skipping 11 matching lines...) Expand all
22 #include "cc/test/test_shared_bitmap_manager.h" 22 #include "cc/test/test_shared_bitmap_manager.h"
23 #include "cc/test/test_task_graph_runner.h" 23 #include "cc/test/test_task_graph_runner.h"
24 #include "cc/trees/layer_tree_impl.h" 24 #include "cc/trees/layer_tree_impl.h"
25 #include "ui/gfx/geometry/point_conversions.h" 25 #include "ui/gfx/geometry/point_conversions.h"
26 #include "ui/gfx/geometry/size_conversions.h" 26 #include "ui/gfx/geometry/size_conversions.h"
27 #include "ui/gfx/geometry/vector2d_conversions.h" 27 #include "ui/gfx/geometry/vector2d_conversions.h"
28 28
29 namespace cc { 29 namespace cc {
30 namespace { 30 namespace {
31 31
32 scoped_ptr<ScrollState> BeginState(const gfx::Point& point) { 32 std::unique_ptr<ScrollState> BeginState(const gfx::Point& point) {
33 ScrollStateData scroll_state_data; 33 ScrollStateData scroll_state_data;
34 scroll_state_data.is_beginning = true; 34 scroll_state_data.is_beginning = true;
35 scroll_state_data.start_position_x = point.x(); 35 scroll_state_data.start_position_x = point.x();
36 scroll_state_data.start_position_y = point.y(); 36 scroll_state_data.start_position_y = point.y();
37 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); 37 std::unique_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
38 return scroll_state; 38 return scroll_state;
39 } 39 }
40 40
41 scoped_ptr<ScrollState> UpdateState(const gfx::Point& point, 41 std::unique_ptr<ScrollState> UpdateState(const gfx::Point& point,
42 const gfx::Vector2dF& delta) { 42 const gfx::Vector2dF& delta) {
43 ScrollStateData scroll_state_data; 43 ScrollStateData scroll_state_data;
44 scroll_state_data.delta_x = delta.x(); 44 scroll_state_data.delta_x = delta.x();
45 scroll_state_data.delta_y = delta.y(); 45 scroll_state_data.delta_y = delta.y();
46 scroll_state_data.start_position_x = point.x(); 46 scroll_state_data.start_position_x = point.x();
47 scroll_state_data.start_position_y = point.y(); 47 scroll_state_data.start_position_y = point.y();
48 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); 48 std::unique_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
49 return scroll_state; 49 return scroll_state;
50 } 50 }
51 51
52 scoped_ptr<ScrollState> EndState() { 52 std::unique_ptr<ScrollState> EndState() {
53 ScrollStateData scroll_state_data; 53 ScrollStateData scroll_state_data;
54 scroll_state_data.is_ending = true; 54 scroll_state_data.is_ending = true;
55 scoped_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data)); 55 std::unique_ptr<ScrollState> scroll_state(new ScrollState(scroll_state_data));
56 return scroll_state; 56 return scroll_state;
57 } 57 }
58 58
59 static ScrollTree* ScrollTreeForLayer(LayerImpl* layer_impl) { 59 static ScrollTree* ScrollTreeForLayer(LayerImpl* layer_impl) {
60 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree; 60 return &layer_impl->layer_tree_impl()->property_trees()->scroll_tree;
61 } 61 }
62 62
63 class LayerTreeHostScrollTest : public LayerTreeTest { 63 class LayerTreeHostScrollTest : public LayerTreeTest {
64 protected: 64 protected:
65 void SetupTree() override { 65 void SetupTree() override {
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 ASSERT_TRUE(impl_thread.task_runner()); 1298 ASSERT_TRUE(impl_thread.task_runner());
1299 TestSharedBitmapManager shared_bitmap_manager; 1299 TestSharedBitmapManager shared_bitmap_manager;
1300 TestTaskGraphRunner task_graph_runner; 1300 TestTaskGraphRunner task_graph_runner;
1301 1301
1302 LayerTreeHost::InitParams params; 1302 LayerTreeHost::InitParams params;
1303 params.client = &client; 1303 params.client = &client;
1304 params.shared_bitmap_manager = &shared_bitmap_manager; 1304 params.shared_bitmap_manager = &shared_bitmap_manager;
1305 params.task_graph_runner = &task_graph_runner; 1305 params.task_graph_runner = &task_graph_runner;
1306 params.settings = &settings; 1306 params.settings = &settings;
1307 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 1307 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
1308 scoped_ptr<LayerTreeHost> layer_tree_host = 1308 std::unique_ptr<LayerTreeHost> layer_tree_host =
1309 LayerTreeHost::CreateThreaded(impl_thread.task_runner(), &params); 1309 LayerTreeHost::CreateThreaded(impl_thread.task_runner(), &params);
1310 1310
1311 impl_thread.task_runner()->PostTask( 1311 impl_thread.task_runner()->PostTask(
1312 FROM_HERE, base::Bind(&BindInputHandlerOnCompositorThread, 1312 FROM_HERE, base::Bind(&BindInputHandlerOnCompositorThread,
1313 layer_tree_host->GetInputHandler(), 1313 layer_tree_host->GetInputHandler(),
1314 base::Unretained(&input_handler_client))); 1314 base::Unretained(&input_handler_client)));
1315 1315
1316 layer_tree_host->DidStopFlinging(); 1316 layer_tree_host->DidStopFlinging();
1317 layer_tree_host = nullptr; 1317 layer_tree_host = nullptr;
1318 impl_thread.Stop(); 1318 impl_thread.Stop();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1424 RunTest(CompositorMode::THREADED, false); 1424 RunTest(CompositorMode::THREADED, false);
1425 } 1425 }
1426 1426
1427 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) { 1427 TEST_F(LayerTreeHostScrollTestLayerStructureChange, ScrollDestroyWholeTree) {
1428 scroll_destroy_whole_tree_ = true; 1428 scroll_destroy_whole_tree_ = true;
1429 RunTest(CompositorMode::THREADED, false); 1429 RunTest(CompositorMode::THREADED, false);
1430 } 1430 }
1431 1431
1432 } // namespace 1432 } // namespace
1433 } // namespace cc 1433 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_remote_server.cc ('k') | cc/trees/layer_tree_host_unittest_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698