| 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) { |
| 194 return base::WrapUnique(new LayerTreeHostImpl( | 195 return base::WrapUnique(new LayerTreeHostImpl( |
| 195 settings, client, task_runner_provider, rendering_stats_instrumentation, | 196 settings, client, task_runner_provider, rendering_stats_instrumentation, |
| 196 task_graph_runner, std::move(mutator_host), id)); | 197 task_graph_runner, std::move(mutator_host), id, |
| 198 std::move(image_worker_task_runner))); |
| 197 } | 199 } |
| 198 | 200 |
| 199 LayerTreeHostImpl::LayerTreeHostImpl( | 201 LayerTreeHostImpl::LayerTreeHostImpl( |
| 200 const LayerTreeSettings& settings, | 202 const LayerTreeSettings& settings, |
| 201 LayerTreeHostImplClient* client, | 203 LayerTreeHostImplClient* client, |
| 202 TaskRunnerProvider* task_runner_provider, | 204 TaskRunnerProvider* task_runner_provider, |
| 203 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 205 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
| 204 TaskGraphRunner* task_graph_runner, | 206 TaskGraphRunner* task_graph_runner, |
| 205 std::unique_ptr<MutatorHost> mutator_host, | 207 std::unique_ptr<MutatorHost> mutator_host, |
| 206 int id) | 208 int id, |
| 209 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner) |
| 207 : client_(client), | 210 : client_(client), |
| 208 task_runner_provider_(task_runner_provider), | 211 task_runner_provider_(task_runner_provider), |
| 209 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), | 212 current_begin_frame_tracker_(BEGINFRAMETRACKER_FROM_HERE), |
| 210 compositor_frame_sink_(nullptr), | 213 compositor_frame_sink_(nullptr), |
| 211 need_update_gpu_rasterization_status_(false), | 214 need_update_gpu_rasterization_status_(false), |
| 212 content_is_suitable_for_gpu_rasterization_(true), | 215 content_is_suitable_for_gpu_rasterization_(true), |
| 213 has_gpu_rasterization_trigger_(false), | 216 has_gpu_rasterization_trigger_(false), |
| 214 use_gpu_rasterization_(false), | 217 use_gpu_rasterization_(false), |
| 215 use_msaa_(false), | 218 use_msaa_(false), |
| 216 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 219 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
| 217 input_handler_client_(NULL), | 220 input_handler_client_(NULL), |
| 218 did_lock_scrolling_layer_(false), | 221 did_lock_scrolling_layer_(false), |
| 219 wheel_scrolling_(false), | 222 wheel_scrolling_(false), |
| 220 scroll_affects_scroll_handler_(false), | 223 scroll_affects_scroll_handler_(false), |
| 221 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), | 224 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), |
| 222 tile_priorities_dirty_(false), | 225 tile_priorities_dirty_(false), |
| 223 settings_(settings), | 226 settings_(settings), |
| 224 visible_(false), | 227 visible_(false), |
| 225 cached_managed_memory_policy_(settings.gpu_memory_policy), | 228 cached_managed_memory_policy_(settings.gpu_memory_policy), |
| 226 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && | 229 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && |
| 227 !settings.single_thread_proxy_scheduler), | 230 !settings.single_thread_proxy_scheduler), |
| 228 // Must be initialized after is_synchronous_single_threaded_ and | 231 // Must be initialized after is_synchronous_single_threaded_ and |
| 229 // task_runner_provider_. | 232 // task_runner_provider_. |
| 230 tile_manager_(this, | 233 tile_manager_(this, |
| 231 GetTaskRunner(), | 234 GetTaskRunner(), |
| 235 std::move(image_worker_task_runner), |
| 232 is_synchronous_single_threaded_ | 236 is_synchronous_single_threaded_ |
| 233 ? std::numeric_limits<size_t>::max() | 237 ? std::numeric_limits<size_t>::max() |
| 234 : settings.scheduled_raster_task_limit, | 238 : settings.scheduled_raster_task_limit, |
| 235 settings.use_partial_raster, | 239 settings.use_partial_raster, |
| 236 settings.check_tile_priority_inversion), | 240 settings.check_tile_priority_inversion), |
| 237 pinch_gesture_active_(false), | 241 pinch_gesture_active_(false), |
| 238 pinch_gesture_end_should_clear_scrolling_layer_(false), | 242 pinch_gesture_end_should_clear_scrolling_layer_(false), |
| 239 fps_counter_( | 243 fps_counter_( |
| 240 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), | 244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), |
| 241 memory_history_(MemoryHistory::Create()), | 245 memory_history_(MemoryHistory::Create()), |
| (...skipping 24 matching lines...) Expand all Loading... |
| 266 active_tree_->property_trees()->is_active = true; | 270 active_tree_->property_trees()->is_active = true; |
| 267 | 271 |
| 268 viewport_ = Viewport::Create(this); | 272 viewport_ = Viewport::Create(this); |
| 269 | 273 |
| 270 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 274 TRACE_EVENT_OBJECT_CREATED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 271 "cc::LayerTreeHostImpl", id_); | 275 "cc::LayerTreeHostImpl", id_); |
| 272 | 276 |
| 273 browser_controls_offset_manager_ = BrowserControlsOffsetManager::Create( | 277 browser_controls_offset_manager_ = BrowserControlsOffsetManager::Create( |
| 274 this, settings.top_controls_show_threshold, | 278 this, settings.top_controls_show_threshold, |
| 275 settings.top_controls_hide_threshold); | 279 settings.top_controls_hide_threshold); |
| 280 |
| 281 tile_manager_.SetDecodedImageTracker(&decoded_image_tracker_); |
| 276 } | 282 } |
| 277 | 283 |
| 278 LayerTreeHostImpl::~LayerTreeHostImpl() { | 284 LayerTreeHostImpl::~LayerTreeHostImpl() { |
| 279 DCHECK(task_runner_provider_->IsImplThread()); | 285 DCHECK(task_runner_provider_->IsImplThread()); |
| 280 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 286 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
| 281 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 287 TRACE_EVENT_OBJECT_DELETED_WITH_ID(TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 282 "cc::LayerTreeHostImpl", id_); | 288 "cc::LayerTreeHostImpl", id_); |
| 283 | 289 |
| 284 // It is released before shutdown. | 290 // It is released before shutdown. |
| 285 DCHECK(!compositor_frame_sink_); | 291 DCHECK(!compositor_frame_sink_); |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 input_handler_client_->DeliverInputForBeginFrame(); | 1836 input_handler_client_->DeliverInputForBeginFrame(); |
| 1831 | 1837 |
| 1832 Animate(); | 1838 Animate(); |
| 1833 | 1839 |
| 1834 for (auto* it : video_frame_controllers_) | 1840 for (auto* it : video_frame_controllers_) |
| 1835 it->OnBeginFrame(args); | 1841 it->OnBeginFrame(args); |
| 1836 } | 1842 } |
| 1837 | 1843 |
| 1838 void LayerTreeHostImpl::DidFinishImplFrame() { | 1844 void LayerTreeHostImpl::DidFinishImplFrame() { |
| 1839 current_begin_frame_tracker_.Finish(); | 1845 current_begin_frame_tracker_.Finish(); |
| 1846 decoded_image_tracker_.NotifyFrameFinished(); |
| 1840 } | 1847 } |
| 1841 | 1848 |
| 1842 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1849 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
| 1843 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1850 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
| 1844 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); | 1851 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); |
| 1845 | 1852 |
| 1846 if (!inner_container) | 1853 if (!inner_container) |
| 1847 return; | 1854 return; |
| 1848 | 1855 |
| 1849 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); | 1856 ViewportAnchor anchor(InnerViewportScrollLayer(), OuterViewportScrollLayer()); |
| (...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 worker_context_visibility_ = | 4087 worker_context_visibility_ = |
| 4081 worker_context->CacheController()->ClientBecameVisible(); | 4088 worker_context->CacheController()->ClientBecameVisible(); |
| 4082 } else { | 4089 } else { |
| 4083 worker_context->CacheController()->ClientBecameNotVisible( | 4090 worker_context->CacheController()->ClientBecameNotVisible( |
| 4084 std::move(worker_context_visibility_)); | 4091 std::move(worker_context_visibility_)); |
| 4085 } | 4092 } |
| 4086 } | 4093 } |
| 4087 } | 4094 } |
| 4088 | 4095 |
| 4089 } // namespace cc | 4096 } // namespace cc |
| OLD | NEW |