| OLD | NEW |
| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <stack> | 8 #include <stack> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return layer_tree_host.Pass(); | 85 return layer_tree_host.Pass(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( | 88 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( |
| 89 LayerTreeHostClient* client, | 89 LayerTreeHostClient* client, |
| 90 LayerTreeHostSingleThreadClient* single_thread_client, | 90 LayerTreeHostSingleThreadClient* single_thread_client, |
| 91 SharedBitmapManager* shared_bitmap_manager, | 91 SharedBitmapManager* shared_bitmap_manager, |
| 92 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 92 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 93 const LayerTreeSettings& settings, | 93 const LayerTreeSettings& settings, |
| 94 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 94 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 95 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 95 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
| 96 ProxyBeginFrameSource* proxy_begin_frame_source) { |
| 96 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( | 97 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( |
| 97 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); | 98 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); |
| 98 layer_tree_host->InitializeSingleThreaded(single_thread_client, | 99 layer_tree_host->InitializeSingleThreaded(single_thread_client, |
| 99 main_task_runner, | 100 main_task_runner, |
| 100 external_begin_frame_source.Pass()); | 101 external_begin_frame_source.Pass(), |
| 102 proxy_begin_frame_source); |
| 101 return layer_tree_host.Pass(); | 103 return layer_tree_host.Pass(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 LayerTreeHost::LayerTreeHost( | 106 LayerTreeHost::LayerTreeHost( |
| 105 LayerTreeHostClient* client, | 107 LayerTreeHostClient* client, |
| 106 SharedBitmapManager* shared_bitmap_manager, | 108 SharedBitmapManager* shared_bitmap_manager, |
| 107 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 109 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 108 const LayerTreeSettings& settings) | 110 const LayerTreeSettings& settings) |
| 109 : micro_benchmark_controller_(this), | 111 : micro_benchmark_controller_(this), |
| 110 next_ui_resource_id_(1), | 112 next_ui_resource_id_(1), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 153 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 152 InitializeProxy(ThreadProxy::Create(this, | 154 InitializeProxy(ThreadProxy::Create(this, |
| 153 main_task_runner, | 155 main_task_runner, |
| 154 impl_task_runner, | 156 impl_task_runner, |
| 155 external_begin_frame_source.Pass())); | 157 external_begin_frame_source.Pass())); |
| 156 } | 158 } |
| 157 | 159 |
| 158 void LayerTreeHost::InitializeSingleThreaded( | 160 void LayerTreeHost::InitializeSingleThreaded( |
| 159 LayerTreeHostSingleThreadClient* single_thread_client, | 161 LayerTreeHostSingleThreadClient* single_thread_client, |
| 160 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 162 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 161 scoped_ptr<BeginFrameSource> external_begin_frame_source) { | 163 scoped_ptr<BeginFrameSource> external_begin_frame_source, |
| 164 ProxyBeginFrameSource* proxy_begin_frame_source) { |
| 162 InitializeProxy( | 165 InitializeProxy( |
| 163 SingleThreadProxy::Create(this, | 166 SingleThreadProxy::Create(this, |
| 164 single_thread_client, | 167 single_thread_client, |
| 165 main_task_runner, | 168 main_task_runner, |
| 166 external_begin_frame_source.Pass())); | 169 external_begin_frame_source.Pass(), |
| 170 proxy_begin_frame_source)); |
| 167 } | 171 } |
| 168 | 172 |
| 169 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { | 173 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
| 170 InitializeProxy(proxy_for_testing.Pass()); | 174 InitializeProxy(proxy_for_testing.Pass()); |
| 171 } | 175 } |
| 172 | 176 |
| 173 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { | 177 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
| 174 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); | 178 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
| 175 | 179 |
| 176 proxy_ = proxy.Pass(); | 180 proxy_ = proxy.Pass(); |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 } | 1365 } |
| 1362 | 1366 |
| 1363 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1367 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { |
| 1364 surface_id_namespace_ = id_namespace; | 1368 surface_id_namespace_ = id_namespace; |
| 1365 } | 1369 } |
| 1366 | 1370 |
| 1367 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1371 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
| 1368 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1372 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); |
| 1369 } | 1373 } |
| 1370 | 1374 |
| 1371 void LayerTreeHost::SetChildrenNeedBeginFrames( | |
| 1372 bool children_need_begin_frames) const { | |
| 1373 proxy_->SetChildrenNeedBeginFrames(children_need_begin_frames); | |
| 1374 } | |
| 1375 | |
| 1376 void LayerTreeHost::SendBeginFramesToChildren( | |
| 1377 const BeginFrameArgs& args) const { | |
| 1378 client_->SendBeginFramesToChildren(args); | |
| 1379 } | |
| 1380 | |
| 1381 } // namespace cc | 1375 } // namespace cc |
| OLD | NEW |