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

Side by Side Diff: cc/test/layer_tree_host_remote_for_testing.cc

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: rebase Created 4 years, 1 month 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 "cc/test/layer_tree_host_remote_for_testing.h" 5 #include "cc/test/layer_tree_host_remote_for_testing.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/blimp/compositor_proto_state.h" 9 #include "cc/blimp/compositor_proto_state.h"
10 #include "cc/blimp/compositor_state_deserializer.h" 10 #include "cc/blimp/compositor_state_deserializer.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return base::MakeUnique<RemoteCompositorBridgeImpl>( 106 return base::MakeUnique<RemoteCompositorBridgeImpl>(
107 std::move(main_task_runner)); 107 std::move(main_task_runner));
108 } 108 }
109 109
110 // static 110 // static
111 std::unique_ptr<LayerTreeHostRemoteForTesting> 111 std::unique_ptr<LayerTreeHostRemoteForTesting>
112 LayerTreeHostRemoteForTesting::Create( 112 LayerTreeHostRemoteForTesting::Create(
113 LayerTreeHostClient* client, 113 LayerTreeHostClient* client,
114 std::unique_ptr<AnimationHost> animation_host, 114 std::unique_ptr<AnimationHost> animation_host,
115 LayerTreeSettings const* settings, 115 LayerTreeSettings const* settings,
116 SharedBitmapManager* shared_bitmap_manager,
117 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
118 TaskGraphRunner* task_graph_runner, 116 TaskGraphRunner* task_graph_runner,
119 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 117 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
120 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 118 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
121 std::unique_ptr<FakeImageSerializationProcessor> 119 std::unique_ptr<FakeImageSerializationProcessor>
122 image_serialization_processor = 120 image_serialization_processor =
123 base::MakeUnique<FakeImageSerializationProcessor>(); 121 base::MakeUnique<FakeImageSerializationProcessor>();
124 122
125 LayerTreeHostRemote::InitParams params; 123 LayerTreeHostRemote::InitParams params;
126 params.client = client; 124 params.client = client;
127 params.main_task_runner = main_task_runner; 125 params.main_task_runner = main_task_runner;
128 params.animation_host = std::move(animation_host); 126 params.animation_host = std::move(animation_host);
129 params.remote_compositor_bridge = 127 params.remote_compositor_bridge =
130 CreateRemoteCompositorBridge(main_task_runner); 128 CreateRemoteCompositorBridge(main_task_runner);
131 params.engine_picture_cache = 129 params.engine_picture_cache =
132 image_serialization_processor->CreateEnginePictureCache(); 130 image_serialization_processor->CreateEnginePictureCache();
133 params.settings = settings; 131 params.settings = settings;
134 132
135 std::unique_ptr<LayerTreeHostRemoteForTesting> layer_tree_host = 133 std::unique_ptr<LayerTreeHostRemoteForTesting> layer_tree_host =
136 base::WrapUnique(new LayerTreeHostRemoteForTesting(&params)); 134 base::WrapUnique(new LayerTreeHostRemoteForTesting(&params));
137 layer_tree_host->Initialize(shared_bitmap_manager, gpu_memory_buffer_manager, 135 layer_tree_host->Initialize(task_graph_runner, main_task_runner,
138 task_graph_runner, main_task_runner,
139 impl_task_runner, 136 impl_task_runner,
140 std::move(image_serialization_processor)); 137 std::move(image_serialization_processor));
141 return layer_tree_host; 138 return layer_tree_host;
142 } 139 }
143 140
144 LayerTreeHostRemoteForTesting::LayerTreeHostRemoteForTesting(InitParams* params) 141 LayerTreeHostRemoteForTesting::LayerTreeHostRemoteForTesting(InitParams* params)
145 : LayerTreeHostRemote(params), 142 : LayerTreeHostRemote(params),
146 layer_tree_host_in_process_client_( 143 layer_tree_host_in_process_client_(
147 base::MakeUnique<LayerTreeHostInProcessClient>(this)) {} 144 base::MakeUnique<LayerTreeHostInProcessClient>(this)) {}
148 145
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Pass through because the InProcessHost has the input handler. 184 // Pass through because the InProcessHost has the input handler.
188 layer_tree_host_in_process_->NotifyInputThrottledUntilCommit(); 185 layer_tree_host_in_process_->NotifyInputThrottledUntilCommit();
189 } 186 }
190 187
191 const base::WeakPtr<InputHandler>& 188 const base::WeakPtr<InputHandler>&
192 LayerTreeHostRemoteForTesting::GetInputHandler() const { 189 LayerTreeHostRemoteForTesting::GetInputHandler() const {
193 return layer_tree_host_in_process_->GetInputHandler(); 190 return layer_tree_host_in_process_->GetInputHandler();
194 } 191 }
195 192
196 void LayerTreeHostRemoteForTesting::Initialize( 193 void LayerTreeHostRemoteForTesting::Initialize(
197 SharedBitmapManager* shared_bitmap_manager,
198 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
199 TaskGraphRunner* task_graph_runner, 194 TaskGraphRunner* task_graph_runner,
200 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 195 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
201 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 196 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
202 std::unique_ptr<FakeImageSerializationProcessor> 197 std::unique_ptr<FakeImageSerializationProcessor>
203 image_serialization_processor) { 198 image_serialization_processor) {
204 image_serialization_processor_ = std::move(image_serialization_processor); 199 image_serialization_processor_ = std::move(image_serialization_processor);
205 RemoteCompositorBridgeImpl* remote_compositor_bridge_impl = 200 RemoteCompositorBridgeImpl* remote_compositor_bridge_impl =
206 static_cast<RemoteCompositorBridgeImpl*>(remote_compositor_bridge()); 201 static_cast<RemoteCompositorBridgeImpl*>(remote_compositor_bridge());
207 remote_compositor_bridge_impl->SetRemoteHost(this); 202 remote_compositor_bridge_impl->SetRemoteHost(this);
208 203
209 layer_tree_host_in_process_ = CreateLayerTreeHostInProcess( 204 layer_tree_host_in_process_ = CreateLayerTreeHostInProcess(
210 layer_tree_host_in_process_client_.get(), shared_bitmap_manager, 205 layer_tree_host_in_process_client_.get(), task_graph_runner,
211 gpu_memory_buffer_manager, task_graph_runner, GetSettings(), 206 GetSettings(), main_task_runner, impl_task_runner);
212 main_task_runner, impl_task_runner);
213 207
214 compositor_state_deserializer_ = 208 compositor_state_deserializer_ =
215 base::MakeUnique<CompositorStateDeserializer>( 209 base::MakeUnique<CompositorStateDeserializer>(
216 layer_tree_host_in_process_.get(), 210 layer_tree_host_in_process_.get(),
217 image_serialization_processor_->CreateClientPictureCache(), 211 image_serialization_processor_->CreateClientPictureCache(),
218 base::Bind(&LayerTreeHostRemoteForTesting::LayerDidScroll, 212 base::Bind(&LayerTreeHostRemoteForTesting::LayerDidScroll,
219 base::Unretained(this)), 213 base::Unretained(this)),
220 this); 214 this);
221 215
222 // Override the LayerFactory since a lot of tests rely on the fact that Layers 216 // Override the LayerFactory since a lot of tests rely on the fact that Layers
223 // and LayerImpls have matching ids. 217 // and LayerImpls have matching ids.
224 compositor_state_deserializer_->SetLayerFactoryForTesting( 218 compositor_state_deserializer_->SetLayerFactoryForTesting(
225 base::MakeUnique<RemoteClientLayerFactory>()); 219 base::MakeUnique<RemoteClientLayerFactory>());
226 220
227 // Override the TaskRunnerProvider since tests may rely on accessing the impl 221 // Override the TaskRunnerProvider since tests may rely on accessing the impl
228 // task runner using it. 222 // task runner using it.
229 SetTaskRunnerProviderForTesting( 223 SetTaskRunnerProviderForTesting(
230 TaskRunnerProvider::Create(main_task_runner, impl_task_runner)); 224 TaskRunnerProvider::Create(main_task_runner, impl_task_runner));
231 } 225 }
232 226
233 std::unique_ptr<LayerTreeHostInProcess> 227 std::unique_ptr<LayerTreeHostInProcess>
234 LayerTreeHostRemoteForTesting::CreateLayerTreeHostInProcess( 228 LayerTreeHostRemoteForTesting::CreateLayerTreeHostInProcess(
235 LayerTreeHostClient* client, 229 LayerTreeHostClient* client,
236 SharedBitmapManager* shared_bitmap_manager,
237 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
238 TaskGraphRunner* task_graph_runner, 230 TaskGraphRunner* task_graph_runner,
239 const LayerTreeSettings& settings, 231 const LayerTreeSettings& settings,
240 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 232 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
241 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 233 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
242 LayerTreeHostInProcess::InitParams params; 234 LayerTreeHostInProcess::InitParams params;
243 235
244 params.client = client; 236 params.client = client;
245 params.shared_bitmap_manager = shared_bitmap_manager;
246 params.gpu_memory_buffer_manager = gpu_memory_buffer_manager;
247 params.task_graph_runner = task_graph_runner; 237 params.task_graph_runner = task_graph_runner;
248 params.settings = &settings; 238 params.settings = &settings;
249 params.main_task_runner = main_task_runner; 239 params.main_task_runner = main_task_runner;
250 params.animation_host = AnimationHost::CreateMainInstance(); 240 params.animation_host = AnimationHost::CreateMainInstance();
251 241
252 return LayerTreeHostInProcess::CreateThreaded(impl_task_runner, &params); 242 return LayerTreeHostInProcess::CreateThreaded(impl_task_runner, &params);
253 } 243 }
254 244
255 void LayerTreeHostRemoteForTesting::DispatchDrawAndSubmitCallbacks() { 245 void LayerTreeHostRemoteForTesting::DispatchDrawAndSubmitCallbacks() {
256 // Don't dispatch callbacks right after the commit on the remote host. Since 246 // Don't dispatch callbacks right after the commit on the remote host. Since
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 303 }
314 304
315 // The only case where the remote host would give a compositor update is if 305 // The only case where the remote host would give a compositor update is if
316 // they wanted the main frame to go till the commit pipeline stage. So 306 // they wanted the main frame to go till the commit pipeline stage. So
317 // request one to make sure that the in process main frame also goes till 307 // request one to make sure that the in process main frame also goes till
318 // the commit step. 308 // the commit step.
319 layer_tree_host_in_process_->SetNeedsCommit(); 309 layer_tree_host_in_process_->SetNeedsCommit();
320 } 310 }
321 311
322 } // namespace cc 312 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/layer_tree_host_remote_for_testing.h ('k') | cc/test/layer_tree_json_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698