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

Side by Side Diff: cc/test/fake_layer_tree_host.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
« no previous file with comments | « cc/test/fake_layer_tree_host.h ('k') | cc/test/fake_layer_tree_host_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/fake_layer_tree_host.h" 5 #include "cc/test/fake_layer_tree_host.h"
6 6
7 #include "base/memory/ptr_util.h"
7 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
8 #include "cc/layers/layer.h" 9 #include "cc/layers/layer.h"
9 #include "cc/test/fake_image_serialization_processor.h" 10 #include "cc/test/fake_image_serialization_processor.h"
10 #include "cc/test/test_task_graph_runner.h" 11 #include "cc/test/test_task_graph_runner.h"
11 12
12 namespace cc { 13 namespace cc {
13 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, 14 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client,
14 LayerTreeHost::InitParams* params, 15 LayerTreeHost::InitParams* params,
15 CompositorMode mode) 16 CompositorMode mode)
16 : LayerTreeHost(params, mode), 17 : LayerTreeHost(params, mode),
17 client_(client), 18 client_(client),
18 host_impl_(*params->settings, 19 host_impl_(*params->settings,
19 &task_runner_provider_, 20 &task_runner_provider_,
20 &manager_, 21 &manager_,
21 params->task_graph_runner), 22 params->task_graph_runner),
22 needs_commit_(false), 23 needs_commit_(false),
23 renderer_capabilities_set(false) { 24 renderer_capabilities_set(false) {
24 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner = 25 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner =
25 mode == CompositorMode::THREADED ? base::ThreadTaskRunnerHandle::Get() 26 mode == CompositorMode::THREADED ? base::ThreadTaskRunnerHandle::Get()
26 : nullptr; 27 : nullptr;
27 SetTaskRunnerProviderForTesting(TaskRunnerProvider::Create( 28 SetTaskRunnerProviderForTesting(TaskRunnerProvider::Create(
28 base::ThreadTaskRunnerHandle::Get(), impl_task_runner)); 29 base::ThreadTaskRunnerHandle::Get(), impl_task_runner));
29 client_->SetLayerTreeHost(this); 30 client_->SetLayerTreeHost(this);
30 } 31 }
31 32
32 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( 33 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
33 FakeLayerTreeHostClient* client, 34 FakeLayerTreeHostClient* client,
34 TestTaskGraphRunner* task_graph_runner) { 35 TestTaskGraphRunner* task_graph_runner) {
35 return Create(client, task_graph_runner, LayerTreeSettings()); 36 return Create(client, task_graph_runner, LayerTreeSettings());
36 } 37 }
37 38
38 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( 39 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
39 FakeLayerTreeHostClient* client, 40 FakeLayerTreeHostClient* client,
40 TestTaskGraphRunner* task_graph_runner, 41 TestTaskGraphRunner* task_graph_runner,
41 const LayerTreeSettings& settings) { 42 const LayerTreeSettings& settings) {
42 return Create(client, task_graph_runner, settings, 43 return Create(client, task_graph_runner, settings,
43 CompositorMode::SINGLE_THREADED); 44 CompositorMode::SINGLE_THREADED);
44 } 45 }
45 46
46 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( 47 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
47 FakeLayerTreeHostClient* client, 48 FakeLayerTreeHostClient* client,
48 TestTaskGraphRunner* task_graph_runner, 49 TestTaskGraphRunner* task_graph_runner,
49 const LayerTreeSettings& settings, 50 const LayerTreeSettings& settings,
50 CompositorMode mode) { 51 CompositorMode mode) {
51 LayerTreeHost::InitParams params; 52 LayerTreeHost::InitParams params;
52 params.client = client; 53 params.client = client;
53 params.settings = &settings; 54 params.settings = &settings;
54 params.task_graph_runner = task_graph_runner; 55 params.task_graph_runner = task_graph_runner;
55 return make_scoped_ptr(new FakeLayerTreeHost(client, &params, mode)); 56 return base::WrapUnique(new FakeLayerTreeHost(client, &params, mode));
56 } 57 }
57 58
58 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( 59 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
59 FakeLayerTreeHostClient* client, 60 FakeLayerTreeHostClient* client,
60 TestTaskGraphRunner* task_graph_runner, 61 TestTaskGraphRunner* task_graph_runner,
61 const LayerTreeSettings& settings, 62 const LayerTreeSettings& settings,
62 CompositorMode mode, 63 CompositorMode mode,
63 ImageSerializationProcessor* image_serialization_processor) { 64 ImageSerializationProcessor* image_serialization_processor) {
64 LayerTreeHost::InitParams params; 65 LayerTreeHost::InitParams params;
65 params.client = client; 66 params.client = client;
66 params.settings = &settings; 67 params.settings = &settings;
67 params.task_graph_runner = task_graph_runner; 68 params.task_graph_runner = task_graph_runner;
68 params.image_serialization_processor = image_serialization_processor; 69 params.image_serialization_processor = image_serialization_processor;
69 return make_scoped_ptr(new FakeLayerTreeHost(client, &params, mode)); 70 return base::WrapUnique(new FakeLayerTreeHost(client, &params, mode));
70 } 71 }
71 72
72 FakeLayerTreeHost::~FakeLayerTreeHost() { 73 FakeLayerTreeHost::~FakeLayerTreeHost() {
73 client_->SetLayerTreeHost(NULL); 74 client_->SetLayerTreeHost(NULL);
74 } 75 }
75 76
76 const RendererCapabilities& FakeLayerTreeHost::GetRendererCapabilities() const { 77 const RendererCapabilities& FakeLayerTreeHost::GetRendererCapabilities() const {
77 if (renderer_capabilities_set) 78 if (renderer_capabilities_set)
78 return renderer_capabilities; 79 return renderer_capabilities;
79 return LayerTreeHost::GetRendererCapabilities(); 80 return LayerTreeHost::GetRendererCapabilities();
(...skipping 28 matching lines...) Expand all
108 pending_tree()->SetPropertyTrees(*property_trees()); 109 pending_tree()->SetPropertyTrees(*property_trees());
109 TreeSynchronizer::PushLayerProperties(root_layer()->layer_tree_host(), 110 TreeSynchronizer::PushLayerProperties(root_layer()->layer_tree_host(),
110 pending_tree()); 111 pending_tree());
111 animation_host()->PushPropertiesTo(host_impl_.animation_host()); 112 animation_host()->PushPropertiesTo(host_impl_.animation_host());
112 113
113 pending_tree()->UpdatePropertyTreeScrollOffset(property_trees()); 114 pending_tree()->UpdatePropertyTreeScrollOffset(property_trees());
114 return pending_tree()->root_layer(); 115 return pending_tree()->root_layer();
115 } 116 }
116 117
117 } // namespace cc 118 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_layer_tree_host.h ('k') | cc/test/fake_layer_tree_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698