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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 content_is_suitable_for_gpu_rasterization_(true), | 215 content_is_suitable_for_gpu_rasterization_(true), |
216 has_gpu_rasterization_trigger_(false), | 216 has_gpu_rasterization_trigger_(false), |
217 use_gpu_rasterization_(false), | 217 use_gpu_rasterization_(false), |
218 use_msaa_(false), | 218 use_msaa_(false), |
219 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), | 219 gpu_rasterization_status_(GpuRasterizationStatus::OFF_DEVICE), |
220 input_handler_client_(NULL), | 220 input_handler_client_(NULL), |
221 did_lock_scrolling_layer_(false), | 221 did_lock_scrolling_layer_(false), |
222 wheel_scrolling_(false), | 222 wheel_scrolling_(false), |
223 scroll_affects_scroll_handler_(false), | 223 scroll_affects_scroll_handler_(false), |
224 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), | 224 scroll_layer_id_mouse_currently_over_(Layer::INVALID_ID), |
| 225 scroll_layer_id_mouse_currently_captured_(Layer::INVALID_ID), |
225 tile_priorities_dirty_(false), | 226 tile_priorities_dirty_(false), |
226 settings_(settings), | 227 settings_(settings), |
227 visible_(false), | 228 visible_(false), |
228 cached_managed_memory_policy_(settings.gpu_memory_policy), | 229 cached_managed_memory_policy_(settings.gpu_memory_policy), |
229 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && | 230 is_synchronous_single_threaded_(!task_runner_provider->HasImplThread() && |
230 !settings.single_thread_proxy_scheduler), | 231 !settings.single_thread_proxy_scheduler), |
231 // Must be initialized after is_synchronous_single_threaded_ and | 232 // Must be initialized after is_synchronous_single_threaded_ and |
232 // task_runner_provider_. | 233 // task_runner_provider_. |
233 tile_manager_(this, | 234 tile_manager_(this, |
234 GetTaskRunner(), | 235 GetTaskRunner(), |
235 std::move(image_worker_task_runner), | 236 std::move(image_worker_task_runner), |
236 is_synchronous_single_threaded_ | 237 is_synchronous_single_threaded_ |
237 ? std::numeric_limits<size_t>::max() | 238 ? std::numeric_limits<size_t>::max() |
238 : settings.scheduled_raster_task_limit, | 239 : settings.scheduled_raster_task_limit, |
239 settings.ToTileManagerSettings()), | 240 settings.ToTileManagerSettings()), |
240 pinch_gesture_active_(false), | 241 pinch_gesture_active_(false), |
241 pinch_gesture_end_should_clear_scrolling_layer_(false), | 242 pinch_gesture_end_should_clear_scrolling_layer_(false), |
242 fps_counter_( | 243 fps_counter_( |
243 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), | 244 FrameRateCounter::Create(task_runner_provider_->HasImplThread())), |
244 memory_history_(MemoryHistory::Create()), | 245 memory_history_(MemoryHistory::Create()), |
245 debug_rect_history_(DebugRectHistory::Create()), | 246 debug_rect_history_(DebugRectHistory::Create()), |
246 max_memory_needed_bytes_(0), | 247 max_memory_needed_bytes_(0), |
247 resourceless_software_draw_(false), | 248 resourceless_software_draw_(false), |
248 mutator_host_(std::move(mutator_host)), | 249 mutator_host_(std::move(mutator_host)), |
249 captured_scrollbar_animation_controller_(nullptr), | |
250 rendering_stats_instrumentation_(rendering_stats_instrumentation), | 250 rendering_stats_instrumentation_(rendering_stats_instrumentation), |
251 micro_benchmark_controller_(this), | 251 micro_benchmark_controller_(this), |
252 task_graph_runner_(task_graph_runner), | 252 task_graph_runner_(task_graph_runner), |
253 id_(id), | 253 id_(id), |
254 requires_high_res_to_draw_(false), | 254 requires_high_res_to_draw_(false), |
255 is_likely_to_require_a_draw_(false), | 255 is_likely_to_require_a_draw_(false), |
256 has_valid_compositor_frame_sink_(false), | 256 has_valid_compositor_frame_sink_(false), |
257 mutator_(nullptr) { | 257 mutator_(nullptr) { |
258 DCHECK(mutator_host_); | 258 DCHECK(mutator_host_); |
259 mutator_host_->SetMutatorHostClient(this); | 259 mutator_host_->SetMutatorHostClient(this); |
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3259 | 3259 |
3260 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( | 3260 return device_viewport_layer_impl_bounds.ManhattanDistanceToPoint( |
3261 device_viewport_point); | 3261 device_viewport_point); |
3262 } | 3262 } |
3263 | 3263 |
3264 void LayerTreeHostImpl::MouseDown() { | 3264 void LayerTreeHostImpl::MouseDown() { |
3265 ScrollbarAnimationController* animation_controller = | 3265 ScrollbarAnimationController* animation_controller = |
3266 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); | 3266 ScrollbarAnimationControllerForId(scroll_layer_id_mouse_currently_over_); |
3267 if (animation_controller) { | 3267 if (animation_controller) { |
3268 animation_controller->DidMouseDown(); | 3268 animation_controller->DidMouseDown(); |
3269 captured_scrollbar_animation_controller_ = animation_controller; | 3269 scroll_layer_id_mouse_currently_captured_ = |
| 3270 scroll_layer_id_mouse_currently_over_; |
3270 } | 3271 } |
3271 } | 3272 } |
3272 | 3273 |
3273 void LayerTreeHostImpl::MouseUp() { | 3274 void LayerTreeHostImpl::MouseUp() { |
3274 if (captured_scrollbar_animation_controller_) { | 3275 if (scroll_layer_id_mouse_currently_captured_ != Layer::INVALID_ID) { |
3275 captured_scrollbar_animation_controller_->DidMouseUp(); | 3276 ScrollbarAnimationController* animation_controller = |
3276 captured_scrollbar_animation_controller_ = nullptr; | 3277 ScrollbarAnimationControllerForId( |
| 3278 scroll_layer_id_mouse_currently_captured_); |
| 3279 |
| 3280 scroll_layer_id_mouse_currently_captured_ = Layer::INVALID_ID; |
| 3281 |
| 3282 if (animation_controller) |
| 3283 animation_controller->DidMouseUp(); |
3277 } | 3284 } |
3278 } | 3285 } |
3279 | 3286 |
3280 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { | 3287 void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
3281 gfx::PointF device_viewport_point = gfx::ScalePoint( | 3288 gfx::PointF device_viewport_point = gfx::ScalePoint( |
3282 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); | 3289 gfx::PointF(viewport_point), active_tree_->device_scale_factor()); |
3283 LayerImpl* layer_impl = | 3290 LayerImpl* layer_impl = |
3284 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); | 3291 active_tree_->FindLayerThatIsHitByPoint(device_viewport_point); |
3285 | 3292 |
3286 // Check if mouse is over a scrollbar or not. | 3293 // Check if mouse is over a scrollbar or not. |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4116 worker_context_visibility_ = | 4123 worker_context_visibility_ = |
4117 worker_context->CacheController()->ClientBecameVisible(); | 4124 worker_context->CacheController()->ClientBecameVisible(); |
4118 } else { | 4125 } else { |
4119 worker_context->CacheController()->ClientBecameNotVisible( | 4126 worker_context->CacheController()->ClientBecameNotVisible( |
4120 std::move(worker_context_visibility_)); | 4127 std::move(worker_context_visibility_)); |
4121 } | 4128 } |
4122 } | 4129 } |
4123 } | 4130 } |
4124 | 4131 |
4125 } // namespace cc | 4132 } // namespace cc |
OLD | NEW |