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

Side by Side Diff: cc/layers/layer_unittest.cc

Issue 2650303002: cc: Remove the LayerTreeHost abstraction. (Closed)
Patch Set: missed ui 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
« no previous file with comments | « cc/BUILD.gn ('k') | cc/layers/picture_layer_unittest.cc » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 EXPECT_FALSE( \ 79 EXPECT_FALSE( \
80 grand_child->GetLayerTree()->LayerNeedsPushPropertiesForTesting( \ 80 grand_child->GetLayerTree()->LayerNeedsPushPropertiesForTesting( \
81 grand_child.get())); 81 grand_child.get()));
82 82
83 namespace cc { 83 namespace cc {
84 84
85 namespace { 85 namespace {
86 86
87 class MockLayerTree : public LayerTree { 87 class MockLayerTree : public LayerTree {
88 public: 88 public:
89 MockLayerTree(LayerTreeHostInProcess::InitParams* params, 89 MockLayerTree(LayerTreeHost::InitParams* params,
90 LayerTreeHost* layer_tree_host) 90 LayerTreeHost* layer_tree_host)
91 : LayerTree(params->mutator_host, layer_tree_host) {} 91 : LayerTree(params->mutator_host, layer_tree_host) {}
92 ~MockLayerTree() override {} 92 ~MockLayerTree() override {}
93 93
94 MOCK_METHOD0(SetNeedsFullTreeSync, void()); 94 MOCK_METHOD0(SetNeedsFullTreeSync, void());
95 }; 95 };
96 96
97 class MockLayerTreeHost : public LayerTreeHostInProcess { 97 class MockLayerTreeHost : public LayerTreeHost {
98 public: 98 public:
99 MockLayerTreeHost(LayerTreeHostSingleThreadClient* single_thread_client, 99 MockLayerTreeHost(LayerTreeHostSingleThreadClient* single_thread_client,
100 LayerTreeHostInProcess::InitParams* params) 100 LayerTreeHost::InitParams* params)
101 : LayerTreeHostInProcess( 101 : LayerTreeHost(
102 params, 102 params,
103 CompositorMode::SINGLE_THREADED, 103 CompositorMode::SINGLE_THREADED,
104 base::MakeUnique<StrictMock<MockLayerTree>>(params, this)) { 104 base::MakeUnique<StrictMock<MockLayerTree>>(params, this)) {
105 InitializeSingleThreaded(single_thread_client, 105 InitializeSingleThreaded(single_thread_client,
106 base::ThreadTaskRunnerHandle::Get()); 106 base::ThreadTaskRunnerHandle::Get());
107 } 107 }
108 108
109 MOCK_METHOD0(SetNeedsCommit, void()); 109 MOCK_METHOD0(SetNeedsCommit, void());
110 MOCK_METHOD0(SetNeedsUpdateLayers, void()); 110 MOCK_METHOD0(SetNeedsUpdateLayers, void());
111 }; 111 };
(...skipping 10 matching lines...) Expand all
122 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_); 122 host_impl_.animation_host()->AddAnimationTimeline(timeline_impl_);
123 } 123 }
124 124
125 const LayerTreeSettings& settings() { return settings_; } 125 const LayerTreeSettings& settings() { return settings_; }
126 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; } 126 scoped_refptr<AnimationTimeline> timeline_impl() { return timeline_impl_; }
127 127
128 protected: 128 protected:
129 void SetUp() override { 129 void SetUp() override {
130 animation_host_ = AnimationHost::CreateForTesting(ThreadInstance::MAIN); 130 animation_host_ = AnimationHost::CreateForTesting(ThreadInstance::MAIN);
131 131
132 LayerTreeHostInProcess::InitParams params; 132 LayerTreeHost::InitParams params;
133 params.client = &fake_client_; 133 params.client = &fake_client_;
134 params.settings = &settings_; 134 params.settings = &settings_;
135 params.task_graph_runner = &task_graph_runner_; 135 params.task_graph_runner = &task_graph_runner_;
136 params.mutator_host = animation_host_.get(); 136 params.mutator_host = animation_host_.get();
137 137
138 layer_tree_host_.reset( 138 layer_tree_host_.reset(
139 new StrictMock<MockLayerTreeHost>(&single_thread_client_, &params)); 139 new StrictMock<MockLayerTreeHost>(&single_thread_client_, &params));
140 layer_tree_ = static_cast<StrictMock<MockLayerTree>*>( 140 layer_tree_ = static_cast<StrictMock<MockLayerTree>*>(
141 layer_tree_host_->GetLayerTree()); 141 layer_tree_host_->GetLayerTree());
142 } 142 }
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 } 1032 }
1033 1033
1034 class LayerTreeHostFactory { 1034 class LayerTreeHostFactory {
1035 public: 1035 public:
1036 std::unique_ptr<LayerTreeHost> Create(MutatorHost* mutator_host) { 1036 std::unique_ptr<LayerTreeHost> Create(MutatorHost* mutator_host) {
1037 return Create(LayerTreeSettings(), mutator_host); 1037 return Create(LayerTreeSettings(), mutator_host);
1038 } 1038 }
1039 1039
1040 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings, 1040 std::unique_ptr<LayerTreeHost> Create(LayerTreeSettings settings,
1041 MutatorHost* mutator_host) { 1041 MutatorHost* mutator_host) {
1042 LayerTreeHostInProcess::InitParams params; 1042 LayerTreeHost::InitParams params;
1043 params.client = &client_; 1043 params.client = &client_;
1044 params.task_graph_runner = &task_graph_runner_; 1044 params.task_graph_runner = &task_graph_runner_;
1045 params.settings = &settings; 1045 params.settings = &settings;
1046 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); 1046 params.main_task_runner = base::ThreadTaskRunnerHandle::Get();
1047 params.mutator_host = mutator_host; 1047 params.mutator_host = mutator_host;
1048 1048
1049 return LayerTreeHostInProcess::CreateSingleThreaded(&single_thread_client_, 1049 return LayerTreeHost::CreateSingleThreaded(&single_thread_client_, &params);
1050 &params);
1051 } 1050 }
1052 1051
1053 private: 1052 private:
1054 FakeLayerTreeHostClient client_; 1053 FakeLayerTreeHostClient client_;
1055 StubLayerTreeHostSingleThreadClient single_thread_client_; 1054 StubLayerTreeHostSingleThreadClient single_thread_client_;
1056 TestTaskGraphRunner task_graph_runner_; 1055 TestTaskGraphRunner task_graph_runner_;
1057 }; 1056 };
1058 1057
1059 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) { 1058 void AssertLayerTreeHostMatchesForSubtree(Layer* layer, LayerTreeHost* host) {
1060 EXPECT_EQ(host, layer->GetLayerTreeHostForTesting()); 1059 EXPECT_EQ(host, layer->GetLayerTreeHostForTesting());
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties()); 1425 EXPECT_EQ(MutableProperty::kNone, impl_layer->mutable_properties());
1427 1426
1428 test_layer->PushPropertiesTo(impl_layer.get()); 1427 test_layer->PushPropertiesTo(impl_layer.get());
1429 1428
1430 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id()); 1429 EXPECT_EQ(ElementId(2, 0), impl_layer->element_id());
1431 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties()); 1430 EXPECT_EQ(MutableProperty::kTransform, impl_layer->mutable_properties());
1432 } 1431 }
1433 1432
1434 } // namespace 1433 } // namespace
1435 } // namespace cc 1434 } // namespace cc
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/layers/picture_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698