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/size_conversions.h" | 44 #include "ui/gfx/size_conversions.h" |
44 | 45 |
(...skipping 18 matching lines...) Expand all Loading... |
63 max_texture_size(0), | 64 max_texture_size(0), |
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* manager, | 71 SharedBitmapManager* manager, |
71 const LayerTreeSettings& settings, | 72 const LayerTreeSettings& settings, |
72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 73 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
73 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 74 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
| 75 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source) { |
74 DCHECK(main_task_runner.get()); | 76 DCHECK(main_task_runner.get()); |
75 DCHECK(impl_task_runner.get()); | 77 DCHECK(impl_task_runner.get()); |
76 scoped_ptr<LayerTreeHost> layer_tree_host( | 78 scoped_ptr<LayerTreeHost> layer_tree_host( |
77 new LayerTreeHost(client, manager, settings)); | 79 new LayerTreeHost(client, manager, settings)); |
78 layer_tree_host->InitializeThreaded(main_task_runner, impl_task_runner); | 80 layer_tree_host->InitializeThreaded(main_task_runner, |
| 81 impl_task_runner, |
| 82 external_begin_frame_source.Pass()); |
79 return layer_tree_host.Pass(); | 83 return layer_tree_host.Pass(); |
80 } | 84 } |
81 | 85 |
82 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( | 86 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( |
83 LayerTreeHostClient* client, | 87 LayerTreeHostClient* client, |
84 LayerTreeHostSingleThreadClient* single_thread_client, | 88 LayerTreeHostSingleThreadClient* single_thread_client, |
85 SharedBitmapManager* manager, | 89 SharedBitmapManager* manager, |
86 const LayerTreeSettings& settings, | 90 const LayerTreeSettings& settings, |
87 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { | 91 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 92 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source) { |
88 scoped_ptr<LayerTreeHost> layer_tree_host( | 93 scoped_ptr<LayerTreeHost> layer_tree_host( |
89 new LayerTreeHost(client, manager, settings)); | 94 new LayerTreeHost(client, manager, settings)); |
90 layer_tree_host->InitializeSingleThreaded(single_thread_client, | 95 layer_tree_host->InitializeSingleThreaded(single_thread_client, |
91 main_task_runner); | 96 main_task_runner, |
| 97 external_begin_frame_source.Pass()); |
92 return layer_tree_host.Pass(); | 98 return layer_tree_host.Pass(); |
93 } | 99 } |
94 | 100 |
95 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, | 101 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, |
96 SharedBitmapManager* manager, | 102 SharedBitmapManager* manager, |
97 const LayerTreeSettings& settings) | 103 const LayerTreeSettings& settings) |
98 : micro_benchmark_controller_(this), | 104 : micro_benchmark_controller_(this), |
99 next_ui_resource_id_(1), | 105 next_ui_resource_id_(1), |
100 inside_begin_main_frame_(false), | 106 inside_begin_main_frame_(false), |
101 needs_full_tree_sync_(true), | 107 needs_full_tree_sync_(true), |
(...skipping 23 matching lines...) Expand all Loading... |
125 next_commit_forces_redraw_(false), | 131 next_commit_forces_redraw_(false), |
126 shared_bitmap_manager_(manager) { | 132 shared_bitmap_manager_(manager) { |
127 if (settings_.accelerated_animation_enabled) | 133 if (settings_.accelerated_animation_enabled) |
128 animation_registrar_ = AnimationRegistrar::Create(); | 134 animation_registrar_ = AnimationRegistrar::Create(); |
129 rendering_stats_instrumentation_->set_record_rendering_stats( | 135 rendering_stats_instrumentation_->set_record_rendering_stats( |
130 debug_state_.RecordRenderingStats()); | 136 debug_state_.RecordRenderingStats()); |
131 } | 137 } |
132 | 138 |
133 void LayerTreeHost::InitializeThreaded( | 139 void LayerTreeHost::InitializeThreaded( |
134 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 140 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
135 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { | 141 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, |
136 InitializeProxy( | 142 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source) { |
137 ThreadProxy::Create(this, main_task_runner, impl_task_runner)); | 143 InitializeProxy(ThreadProxy::Create(this, |
| 144 main_task_runner, |
| 145 impl_task_runner, |
| 146 external_begin_frame_source.Pass())); |
138 } | 147 } |
139 | 148 |
140 void LayerTreeHost::InitializeSingleThreaded( | 149 void LayerTreeHost::InitializeSingleThreaded( |
141 LayerTreeHostSingleThreadClient* single_thread_client, | 150 LayerTreeHostSingleThreadClient* single_thread_client, |
142 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { | 151 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
143 InitializeProxy( | 152 scoped_ptr<ExternalBeginFrameSource> external_begin_frame_source) { |
144 SingleThreadProxy::Create(this, single_thread_client, main_task_runner)); | 153 InitializeProxy(SingleThreadProxy::Create( |
| 154 this, |
| 155 single_thread_client, |
| 156 main_task_runner, |
| 157 external_begin_frame_source.Pass())); |
145 } | 158 } |
146 | 159 |
147 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { | 160 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { |
148 InitializeProxy(proxy_for_testing.Pass()); | 161 InitializeProxy(proxy_for_testing.Pass()); |
149 } | 162 } |
150 | 163 |
151 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { | 164 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
152 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); | 165 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
153 | 166 |
154 proxy_ = proxy.Pass(); | 167 proxy_ = proxy.Pass(); |
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 swap_promise_list_.push_back(swap_promise.Pass()); | 1347 swap_promise_list_.push_back(swap_promise.Pass()); |
1335 } | 1348 } |
1336 | 1349 |
1337 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1350 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1338 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1351 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1339 swap_promise_list_[i]->DidNotSwap(reason); | 1352 swap_promise_list_[i]->DidNotSwap(reason); |
1340 swap_promise_list_.clear(); | 1353 swap_promise_list_.clear(); |
1341 } | 1354 } |
1342 | 1355 |
1343 } // namespace cc | 1356 } // namespace cc |
OLD | NEW |