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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 LayerTreeHostImpl::FrameData::~FrameData() {} | 184 LayerTreeHostImpl::FrameData::~FrameData() {} |
185 | 185 |
186 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 186 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
187 const LayerTreeSettings& settings, | 187 const LayerTreeSettings& settings, |
188 LayerTreeHostImplClient* client, | 188 LayerTreeHostImplClient* client, |
189 TaskRunnerProvider* task_runner_provider, | 189 TaskRunnerProvider* task_runner_provider, |
190 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 190 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
191 TaskGraphRunner* task_graph_runner, | 191 TaskGraphRunner* task_graph_runner, |
192 std::unique_ptr<MutatorHost> mutator_host, | 192 std::unique_ptr<MutatorHost> mutator_host, |
193 int id, | 193 int id) { |
194 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner) { | |
195 return base::WrapUnique(new LayerTreeHostImpl( | 194 return base::WrapUnique(new LayerTreeHostImpl( |
196 settings, client, task_runner_provider, rendering_stats_instrumentation, | 195 settings, client, task_runner_provider, rendering_stats_instrumentation, |
197 task_graph_runner, std::move(mutator_host), id, | 196 task_graph_runner, std::move(mutator_host), id)); |
198 std::move(image_worker_task_runner))); | |
199 } | 197 } |
200 | 198 |
201 LayerTreeHostImpl::LayerTreeHostImpl( | 199 LayerTreeHostImpl::LayerTreeHostImpl( |
202 const LayerTreeSettings& settings, | 200 const LayerTreeSettings& settings, |
203 LayerTreeHostImplClient* client, | 201 LayerTreeHostImplClient* client, |
204 TaskRunnerProvider* task_runner_provider, | 202 TaskRunnerProvider* task_runner_provider, |
205 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 203 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
206 TaskGraphRunner* task_graph_runner, | 204 TaskGraphRunner* task_graph_runner, |
207 std::unique_ptr<MutatorHost> mutator_host, | 205 std::unique_ptr<MutatorHost> mutator_host, |
208 int id, | 206 int id) |
209 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner) | |
210 : client_(client), | 207 : client_(client), |
211 task_runner_provider_(task_runner_provider), | 208 task_runner_provider_(task_runner_provider), |
212 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), | 209 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), |
213 compositor_frame_sink_(nullptr), | 210 compositor_frame_sink_(nullptr), |
214 need_update_gpu_rasterization_status_(false), | 211 need_update_gpu_rasterization_status_(false), |
215 content_is_suitable_for_gpu_rasterization_(true), | 212 content_is_suitable_for_gpu_rasterization_(true), |
216 has_gpu_rasterization_trigger_(false), | 213 has_gpu_rasterization_trigger_(false), |
217 use_gpu_rasterization_(false), | 214 use_gpu_rasterization_(false), |
218 use_msaa_(false), | 215 use_msaa_(false), |
219 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 216 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
220 input_handler_client_(NULL), | 217 input_handler_client_(NULL), |
221 did_lock_scrolling_layer_(false), | 218 did_lock_scrolling_layer_(false), |
222 wheel_scrolling_(false), | 219 wheel_scrolling_(false), |
223 scroll_affects_scroll_handler_(false), | 220 scroll_affects_scroll_handler_(false), |
224 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), | 221 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), |
225 tile_priorities_dirty_(false), | 222 tile_priorities_dirty_(false), |
226 settings_(settings), | 223 settings_(settings), |
227 visible_(false), | 224 visible_(false), |
228 cached_managed_memory_policy_(settings.gpu_memory_policy), | 225 cached_managed_memory_policy_(settings.gpu_memory_policy), |
229 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && | 226 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && |
230 !settings.single_thread_proxy_scheduler), | 227 !settings.single_thread_proxy_scheduler), |
231 // Must be initialized after is_synchronous_single_threaded_ and | 228 // Must be initialized after is_synchronous_single_threaded_ and |
232 // task_runner_provider_. | 229 // task_runner_provider_. |
233 tile_manager_(this, | 230 tile_manager_(this, |
234 GetTaskRunner(), | 231 GetTaskRunner(), |
235 std::move(image_worker_task_runner), | |
236 is_synchronous_single_threaded_ | 232 is_synchronous_single_threaded_ |
237 ? std::numeric_limits<size_t>::max() | 233 ? std::numeric_limits<size_t>::max() |
238 : settings.scheduled_raster_task_limit, | 234 : settings.scheduled_raster_task_limit, |
239 settings.use_partial_raster, | 235 settings.use_partial_raster, |
240 settings.check_tile_priority_inversion), | 236 settings.check_tile_priority_inversion), |
241 pinch_gesture_active_(false), | 237 pinch_gesture_active_(false), |
242 pinch_gesture_end_should_clear_scrolling_layer_(false), | 238 pinch_gesture_end_should_clear_scrolling_layer_(false), |
243 fps_counter_( | 239 fps_counter_( |
244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), | 240 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), |
245 memory_history_(MemoryHistory::Create()), | 241 memory_history_(MemoryHistory::Create()), |
(...skipping 24 matching lines...) Expand all Loading... |
270 active_tree_->property_trees()->is_active = true; | 266 active_tree_->property_trees()->is_active = true; |
271 | 267 |
272 viewport_ = Viewport::Create(this); | 268 viewport_ = Viewport::Create(this); |
273 | 269 |
274 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 270 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
275 "cc::LayerTreeHostImpl", id_); | 271 "cc::LayerTreeHostImpl", id_); |
276 | 272 |
277 browser_controls_offset_manager_ = BrowserControlsOffsetManager::Create( | 273 browser_controls_offset_manager_ = BrowserControlsOffsetManager::Create( |
278 this, settings.top_controls_show_threshold, | 274 this, settings.top_controls_show_threshold, |
279 settings.top_controls_hide_threshold); | 275 settings.top_controls_hide_threshold); |
280 | |
281 tile_manager_.SetDecodedImageTracker(&decoded_image_tracker_); | |
282 } | 276 } |
283 | 277 |
284 LayerTreeHostImpl::~LayerTreeHostImpl() { | 278 LayerTreeHostImpl::~LayerTreeHostImpl() { |
285 DCHECK(task_runner_provider_->IsImplThread()); | 279 DCHECK(task_runner_provider_->IsImplThread()); |
286 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 280 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
287 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 281 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
288 "cc::LayerTreeHostImpl", id_); | 282 "cc::LayerTreeHostImpl", id_); |
289 | 283 |
290 // It is released before shutdown. | 284 // It is released before shutdown. |
291 DCHECK(!compositor_frame_sink_); | 285 DCHECK(!compositor_frame_sink_); |
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 input_handler_client_->DeliverInputForBeginFrame(); | 1840 input_handler_client_->DeliverInputForBeginFrame(); |
1847 | 1841 |
1848 Animate(); | 1842 Animate(); |
1849 | 1843 |
1850 for (auto* it : video_frame_controllers_) | 1844 for (auto* it : video_frame_controllers_) |
1851 it->OnBeginFrame(args); | 1845 it->OnBeginFrame(args); |
1852 } | 1846 } |
1853 | 1847 |
1854 void LayerTreeHostImpl::DidFinishImplFrame() { | 1848 void LayerTreeHostImpl::DidFinishImplFrame() { |
1855 current_begin_frame_tracker_.Finish(); | 1849 current_begin_frame_tracker_.Finish(); |
1856 decoded_image_tracker_.NotifyFrameFinished(); | |
1857 } | 1850 } |
1858 | 1851 |
1859 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1852 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
1860 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1853 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
1861 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); | 1854 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); |
1862 | 1855 |
1863 if (!inner_container) | 1856 if (!inner_container) |
1864 return; | 1857 return; |
1865 | 1858 |
1866 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); | 1859 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); |
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 worker_context_visibility_ = | 4092 worker_context_visibility_ = |
4100 worker_context->CacheController()->ClientBecameVisible(); | 4093 worker_context->CacheController()->ClientBecameVisible(); |
4101 } else { | 4094 } else { |
4102 worker_context->CacheController()->ClientBecameNotVisible( | 4095 worker_context->CacheController()->ClientBecameNotVisible( |
4103 std::move(worker_context_visibility_)); | 4096 std::move(worker_context_visibility_)); |
4104 } | 4097 } |
4105 } | 4098 } |
4106 } | 4099 } |
4107 | 4100 |
4108 } // namespace cc | 4101 } // namespace cc |
OLD | NEW |