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 14 matching lines...) Expand all Loading... |
25 #include "cc/input/layer_selection_bound.h" | 25 #include "cc/input/layer_selection_bound.h" |
26 #include "cc/input/top_controls_manager.h" | 26 #include "cc/input/top_controls_manager.h" |
27 #include "cc/layers/heads_up_display_layer.h" | 27 #include "cc/layers/heads_up_display_layer.h" |
28 #include "cc/layers/heads_up_display_layer_impl.h" | 28 #include "cc/layers/heads_up_display_layer_impl.h" |
29 #include "cc/layers/layer.h" | 29 #include "cc/layers/layer.h" |
30 #include "cc/layers/layer_iterator.h" | 30 #include "cc/layers/layer_iterator.h" |
31 #include "cc/layers/painted_scrollbar_layer.h" | 31 #include "cc/layers/painted_scrollbar_layer.h" |
32 #include "cc/layers/render_surface.h" | 32 #include "cc/layers/render_surface.h" |
33 #include "cc/resources/prioritized_resource_manager.h" | 33 #include "cc/resources/prioritized_resource_manager.h" |
34 #include "cc/resources/ui_resource_request.h" | 34 #include "cc/resources/ui_resource_request.h" |
| 35 #include "cc/scheduler/begin_frame_source.h" |
35 #include "cc/trees/layer_tree_host_client.h" | 36 #include "cc/trees/layer_tree_host_client.h" |
36 #include "cc/trees/layer_tree_host_common.h" | 37 #include "cc/trees/layer_tree_host_common.h" |
37 #include "cc/trees/layer_tree_host_impl.h" | 38 #include "cc/trees/layer_tree_host_impl.h" |
38 #include "cc/trees/layer_tree_impl.h" | 39 #include "cc/trees/layer_tree_impl.h" |
39 #include "cc/trees/occlusion_tracker.h" | 40 #include "cc/trees/occlusion_tracker.h" |
40 #include "cc/trees/single_thread_proxy.h" | 41 #include "cc/trees/single_thread_proxy.h" |
41 #include "cc/trees/thread_proxy.h" | 42 #include "cc/trees/thread_proxy.h" |
42 #include "cc/trees/tree_synchronizer.h" | 43 #include "cc/trees/tree_synchronizer.h" |
43 #include "ui/gfx/geometry/size_conversions.h" | 44 #include "ui/gfx/geometry/size_conversions.h" |
44 | 45 |
(...skipping 19 matching lines...) Expand all Loading... |
64 using_shared_memory_resources(false) {} | 65 using_shared_memory_resources(false) {} |
65 | 66 |
66 RendererCapabilities::~RendererCapabilities() {} | 67 RendererCapabilities::~RendererCapabilities() {} |
67 | 68 |
68 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( | 69 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( |
69 LayerTreeHostClient* client, | 70 LayerTreeHostClient* client, |
70 SharedBitmapManager* shared_bitmap_manager, | 71 SharedBitmapManager* shared_bitmap_manager, |
71 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 72 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
72 const LayerTreeSettings& settings, | 73 const LayerTreeSettings& settings, |
73 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 74 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
74 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 75 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 76 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
75 DCHECK(main_task_runner.get()); | 77 DCHECK(main_task_runner.get()); |
76 DCHECK(impl_task_runner.get()); | 78 DCHECK(impl_task_runner.get()); |
77 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( | 79 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( |
78 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); | 80 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); |
79 layer_tree_host->InitializeThreaded(main_task_runner, impl_task_runner); | 81 layer_tree_host->InitializeThreaded(main_task_runner, |
| 82 impl_task_runner, |
| 83 external_begin_frame_source.Pass()); |
80 return layer_tree_host.Pass(); | 84 return layer_tree_host.Pass(); |
81 } | 85 } |
82 | 86 |
83 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( | 87 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( |
84 LayerTreeHostClient* client, | 88 LayerTreeHostClient* client, |
85 LayerTreeHostSingleThreadClient* single_thread_client, | 89 LayerTreeHostSingleThreadClient* single_thread_client, |
86 SharedBitmapManager* shared_bitmap_manager, | 90 SharedBitmapManager* shared_bitmap_manager, |
87 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 91 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
88 const LayerTreeSettings& settings, | 92 const LayerTreeSettings& settings, |
89 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { | 93 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 94 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
90 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( | 95 scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost( |
91 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); | 96 client, shared_bitmap_manager, gpu_memory_buffer_manager, settings)); |
92 layer_tree_host->InitializeSingleThreaded(single_thread_client, | 97 layer_tree_host->InitializeSingleThreaded(single_thread_client, |
93 main_task_runner); | 98 main_task_runner, |
| 99 external_begin_frame_source.Pass()); |
94 return layer_tree_host.Pass(); | 100 return layer_tree_host.Pass(); |
95 } | 101 } |
96 | 102 |
97 LayerTreeHost::LayerTreeHost( | 103 LayerTreeHost::LayerTreeHost( |
98 LayerTreeHostClient* client, | 104 LayerTreeHostClient* client, |
99 SharedBitmapManager* shared_bitmap_manager, | 105 SharedBitmapManager* shared_bitmap_manager, |
100 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 106 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
101 const LayerTreeSettings& settings) | 107 const LayerTreeSettings& settings) |
102 : micro_benchmark_controller_(this), | 108 : micro_benchmark_controller_(this), |
103 next_ui_resource_id_(1), | 109 next_ui_resource_id_(1), |
(...skipping 28 matching lines...) Expand all Loading... |
132 surface_id_namespace_(0u), | 138 surface_id_namespace_(0u), |
133 next_surface_sequence_(1u) { | 139 next_surface_sequence_(1u) { |
134 if (settings_.accelerated_animation_enabled) | 140 if (settings_.accelerated_animation_enabled) |
135 animation_registrar_ = AnimationRegistrar::Create(); | 141 animation_registrar_ = AnimationRegistrar::Create(); |
136 rendering_stats_instrumentation_->set_record_rendering_stats( | 142 rendering_stats_instrumentation_->set_record_rendering_stats( |
137 debug_state_.RecordRenderingStats()); | 143 debug_state_.RecordRenderingStats()); |
138 } | 144 } |
139 | 145 |
140 void LayerTreeHost::InitializeThreaded( | 146 void LayerTreeHost::InitializeThreaded( |
141 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 147 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
142 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 148 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
143 InitializeProxy( | 149 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
144 ThreadProxy::Create(this, main_task_runner, impl_task_runner)); | 150 InitializeProxy(ThreadProxy::Create(this, |
| 151 main_task_runner, |
| 152 impl_task_runner, |
| 153 external_begin_frame_source.Pass())); |
145 } | 154 } |
146 | 155 |
147 void LayerTreeHost::InitializeSingleThreaded( | 156 void LayerTreeHost::InitializeSingleThreaded( |
148 LayerTreeHostSingleThreadClient* single_thread_client, | 157 LayerTreeHostSingleThreadClient* single_thread_client, |
149 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { | 158 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 159 scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
150 InitializeProxy( | 160 InitializeProxy( |
151 SingleThreadProxy::Create(this, single_thread_client, main_task_runner)); | 161 SingleThreadProxy::Create(this, |
| 162 single_thread_client, |
| 163 main_task_runner, |
| 164 external_begin_frame_source.Pass())); |
152 } | 165 } |
153 | 166 |
154 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { | 167 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
155 InitializeProxy(proxy_for_testing.Pass()); | 168 InitializeProxy(proxy_for_testing.Pass()); |
156 } | 169 } |
157 | 170 |
158 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { | 171 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
159 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); | 172 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
160 | 173 |
161 proxy_ = proxy.Pass(); | 174 proxy_ = proxy.Pass(); |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 | 1351 |
1339 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { | 1352 void LayerTreeHost::set_surface_id_namespace(uint32_t id_namespace) { |
1340 surface_id_namespace_ = id_namespace; | 1353 surface_id_namespace_ = id_namespace; |
1341 } | 1354 } |
1342 | 1355 |
1343 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { | 1356 SurfaceSequence LayerTreeHost::CreateSurfaceSequence() { |
1344 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); | 1357 return SurfaceSequence(surface_id_namespace_, next_surface_sequence_++); |
1345 } | 1358 } |
1346 | 1359 |
1347 } // namespace cc | 1360 } // namespace cc |
OLD | NEW |