OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/client/core/compositor/blimp_compositor.h" | 5 #include "blimp/client/core/compositor/blimp_compositor.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
11 #include "base/numerics/safe_conversions.h" | 11 #include "base/numerics/safe_conversions.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/threading/thread_local.h" | 14 #include "base/threading/thread_local.h" |
15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
17 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 17 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
18 #include "blimp/client/core/compositor/blimp_compositor_frame_sink.h" | 18 #include "blimp/client/core/compositor/blimp_compositor_frame_sink.h" |
19 #include "blimp/client/public/compositor/compositor_dependencies.h" | 19 #include "blimp/client/public/compositor/compositor_dependencies.h" |
20 #include "blimp/net/blimp_stats.h" | 20 #include "blimp/net/blimp_stats.h" |
21 #include "cc/animation/animation_host.h" | 21 #include "cc/animation/animation_host.h" |
22 #include "cc/layers/layer.h" | 22 #include "cc/layers/layer.h" |
23 #include "cc/layers/surface_layer.h" | 23 #include "cc/layers/surface_layer.h" |
24 #include "cc/output/compositor_frame_sink.h" | 24 #include "cc/output/compositor_frame_sink.h" |
25 #include "cc/proto/compositor_message.pb.h" | 25 #include "cc/proto/compositor_message.pb.h" |
26 #include "cc/surfaces/surface.h" | 26 #include "cc/surfaces/surface.h" |
27 #include "cc/surfaces/surface_factory.h" | 27 #include "cc/surfaces/surface_factory.h" |
28 #include "cc/surfaces/surface_id_allocator.h" | 28 #include "cc/surfaces/surface_id_allocator.h" |
29 #include "cc/surfaces/surface_manager.h" | 29 #include "cc/surfaces/surface_manager.h" |
30 #include "cc/trees/layer_tree_host.h" | 30 #include "cc/trees/layer_tree_host_in_process.h" |
31 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" | 31 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" |
32 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
33 #include "ui/gl/gl_surface.h" | 33 #include "ui/gl/gl_surface.h" |
34 | 34 |
35 namespace blimp { | 35 namespace blimp { |
36 namespace client { | 36 namespace client { |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 void SatisfyCallback(cc::SurfaceManager* manager, | 40 void SatisfyCallback(cc::SurfaceManager* manager, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 layer_->RemoveAllChildren(); | 279 layer_->RemoveAllChildren(); |
280 surface_factory_->Destroy(surface_id_); | 280 surface_factory_->Destroy(surface_id_); |
281 surface_id_ = cc::SurfaceId(); | 281 surface_id_ = cc::SurfaceId(); |
282 } | 282 } |
283 | 283 |
284 void BlimpCompositor::CreateLayerTreeHost() { | 284 void BlimpCompositor::CreateLayerTreeHost() { |
285 DCHECK(!host_); | 285 DCHECK(!host_); |
286 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; | 286 VLOG(1) << "Creating LayerTreeHost for render widget: " << render_widget_id_; |
287 | 287 |
288 // Create the LayerTreeHost | 288 // Create the LayerTreeHost |
289 cc::LayerTreeHost::InitParams params; | 289 cc::LayerTreeHostInProcess::InitParams params; |
290 params.client = this; | 290 params.client = this; |
291 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); | 291 params.task_graph_runner = compositor_dependencies_->GetTaskGraphRunner(); |
292 params.gpu_memory_buffer_manager = | 292 params.gpu_memory_buffer_manager = |
293 GetEmbedderDeps()->GetGpuMemoryBufferManager(); | 293 GetEmbedderDeps()->GetGpuMemoryBufferManager(); |
294 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 294 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
295 params.image_serialization_processor = | 295 params.image_serialization_processor = |
296 compositor_dependencies_->GetImageSerializationProcessor(); | 296 compositor_dependencies_->GetImageSerializationProcessor(); |
297 | 297 |
298 cc::LayerTreeSettings* settings = | 298 cc::LayerTreeSettings* settings = |
299 compositor_dependencies_->GetLayerTreeSettings(); | 299 compositor_dependencies_->GetLayerTreeSettings(); |
300 // TODO(khushalsagar): This is a hack. Remove when we move the split point | 300 // TODO(khushalsagar): This is a hack. Remove when we move the split point |
301 // out. For details on why this is needed, see crbug.com/586210. | 301 // out. For details on why this is needed, see crbug.com/586210. |
302 settings->abort_commit_before_compositor_frame_sink_creation = false; | 302 settings->abort_commit_before_compositor_frame_sink_creation = false; |
303 params.settings = settings; | 303 params.settings = settings; |
304 | 304 |
305 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 305 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
306 | 306 |
307 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = | 307 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
308 compositor_dependencies_->GetCompositorTaskRunner(); | 308 compositor_dependencies_->GetCompositorTaskRunner(); |
309 | 309 |
310 host_ = cc::LayerTreeHost::CreateRemoteClient( | 310 host_ = cc::LayerTreeHostInProcess::CreateRemoteClient( |
311 this /* remote_proto_channel */, compositor_task_runner, ¶ms); | 311 this /* remote_proto_channel */, compositor_task_runner, ¶ms); |
312 | 312 |
313 DCHECK(!input_manager_); | 313 DCHECK(!input_manager_); |
314 input_manager_ = BlimpInputManager::Create( | 314 input_manager_ = BlimpInputManager::Create( |
315 this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner, | 315 this, base::ThreadTaskRunnerHandle::Get(), compositor_task_runner, |
316 host_->GetInputHandler()); | 316 host_->GetInputHandler()); |
317 } | 317 } |
318 | 318 |
319 void BlimpCompositor::DestroyLayerTreeHost() { | 319 void BlimpCompositor::DestroyLayerTreeHost() { |
320 DCHECK(host_); | 320 DCHECK(host_); |
(...skipping 28 matching lines...) Expand all Loading... |
349 it->second.Run(); | 349 it->second.Run(); |
350 it = pending_commit_trackers_.erase(it); | 350 it = pending_commit_trackers_.erase(it); |
351 } else { | 351 } else { |
352 ++it; | 352 ++it; |
353 } | 353 } |
354 } | 354 } |
355 } | 355 } |
356 | 356 |
357 } // namespace client | 357 } // namespace client |
358 } // namespace blimp | 358 } // namespace blimp |
OLD | NEW |