| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "cc/resources/texture_mailbox_deleter.h" | 60 #include "cc/resources/texture_mailbox_deleter.h" |
| 61 #include "cc/resources/ui_resource_bitmap.h" | 61 #include "cc/resources/ui_resource_bitmap.h" |
| 62 #include "cc/resources/zero_copy_raster_worker_pool.h" | 62 #include "cc/resources/zero_copy_raster_worker_pool.h" |
| 63 #include "cc/scheduler/delay_based_time_source.h" | 63 #include "cc/scheduler/delay_based_time_source.h" |
| 64 #include "cc/trees/damage_tracker.h" | 64 #include "cc/trees/damage_tracker.h" |
| 65 #include "cc/trees/layer_tree_host.h" | 65 #include "cc/trees/layer_tree_host.h" |
| 66 #include "cc/trees/layer_tree_host_common.h" | 66 #include "cc/trees/layer_tree_host_common.h" |
| 67 #include "cc/trees/layer_tree_impl.h" | 67 #include "cc/trees/layer_tree_impl.h" |
| 68 #include "cc/trees/occlusion_tracker.h" | 68 #include "cc/trees/occlusion_tracker.h" |
| 69 #include "cc/trees/single_thread_proxy.h" | 69 #include "cc/trees/single_thread_proxy.h" |
| 70 #include "cc/trees/tree_scroll_elasticity_client.h" |
| 70 #include "cc/trees/tree_synchronizer.h" | 71 #include "cc/trees/tree_synchronizer.h" |
| 71 #include "gpu/command_buffer/client/gles2_interface.h" | 72 #include "gpu/command_buffer/client/gles2_interface.h" |
| 72 #include "gpu/GLES2/gl2extchromium.h" | 73 #include "gpu/GLES2/gl2extchromium.h" |
| 73 #include "ui/gfx/frame_time.h" | 74 #include "ui/gfx/frame_time.h" |
| 74 #include "ui/gfx/geometry/rect_conversions.h" | 75 #include "ui/gfx/geometry/rect_conversions.h" |
| 75 #include "ui/gfx/geometry/size_conversions.h" | 76 #include "ui/gfx/geometry/size_conversions.h" |
| 76 #include "ui/gfx/geometry/vector2d_conversions.h" | 77 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 77 | 78 |
| 78 namespace cc { | 79 namespace cc { |
| 79 namespace { | 80 namespace { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 : BeginFrameSourceMixIn(), | 272 : BeginFrameSourceMixIn(), |
| 272 client_(client), | 273 client_(client), |
| 273 proxy_(proxy), | 274 proxy_(proxy), |
| 274 use_gpu_rasterization_(false), | 275 use_gpu_rasterization_(false), |
| 275 input_handler_client_(NULL), | 276 input_handler_client_(NULL), |
| 276 did_lock_scrolling_layer_(false), | 277 did_lock_scrolling_layer_(false), |
| 277 should_bubble_scrolls_(false), | 278 should_bubble_scrolls_(false), |
| 278 wheel_scrolling_(false), | 279 wheel_scrolling_(false), |
| 279 scroll_affects_scroll_handler_(false), | 280 scroll_affects_scroll_handler_(false), |
| 280 scroll_layer_id_when_mouse_over_scrollbar_(0), | 281 scroll_layer_id_when_mouse_over_scrollbar_(0), |
| 282 scroll_elasticity_client_( |
| 283 new TreeScrollElasticityClient(this)), |
| 281 tile_priorities_dirty_(false), | 284 tile_priorities_dirty_(false), |
| 282 root_layer_scroll_offset_delegate_(NULL), | 285 root_layer_scroll_offset_delegate_(NULL), |
| 283 settings_(settings), | 286 settings_(settings), |
| 284 visible_(true), | 287 visible_(true), |
| 285 cached_managed_memory_policy_( | 288 cached_managed_memory_policy_( |
| 286 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), | 289 PrioritizedResourceManager::DefaultMemoryAllocationLimit(), |
| 287 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, | 290 gpu::MemoryAllocation::CUTOFF_ALLOW_EVERYTHING, |
| 288 ManagedMemoryPolicy::kDefaultNumResourcesLimit), | 291 ManagedMemoryPolicy::kDefaultNumResourcesLimit), |
| 289 pinch_gesture_active_(false), | 292 pinch_gesture_active_(false), |
| 290 pinch_gesture_end_should_clear_scrolling_layer_(false), | 293 pinch_gesture_end_should_clear_scrolling_layer_(false), |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", | 455 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
| 453 TRACE_EVENT_SCOPE_THREAD); | 456 TRACE_EVENT_SCOPE_THREAD); |
| 454 return false; | 457 return false; |
| 455 } | 458 } |
| 456 return true; | 459 return true; |
| 457 } | 460 } |
| 458 | 461 |
| 459 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { | 462 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { |
| 460 if (input_handler_client_) | 463 if (input_handler_client_) |
| 461 input_handler_client_->Animate(monotonic_time); | 464 input_handler_client_->Animate(monotonic_time); |
| 465 if (scroll_elasticity_client_->controller()) { |
| 466 scroll_elasticity_client_->controller()->Animate( |
| 467 monotonic_time); |
| 468 } |
| 462 AnimatePageScale(monotonic_time); | 469 AnimatePageScale(monotonic_time); |
| 463 AnimateLayers(monotonic_time); | 470 AnimateLayers(monotonic_time); |
| 464 AnimateScrollbars(monotonic_time); | 471 AnimateScrollbars(monotonic_time); |
| 465 AnimateTopControls(monotonic_time); | 472 AnimateTopControls(monotonic_time); |
| 466 } | 473 } |
| 467 | 474 |
| 468 void LayerTreeHostImpl::ManageTiles() { | 475 void LayerTreeHostImpl::ManageTiles() { |
| 469 if (!tile_manager_) | 476 if (!tile_manager_) |
| 470 return; | 477 return; |
| 471 if (!tile_priorities_dirty_) | 478 if (!tile_priorities_dirty_) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 return layer_impl != NULL; | 515 return layer_impl != NULL; |
| 509 } | 516 } |
| 510 | 517 |
| 511 scoped_ptr<SwapPromiseMonitor> | 518 scoped_ptr<SwapPromiseMonitor> |
| 512 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 519 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
| 513 ui::LatencyInfo* latency) { | 520 ui::LatencyInfo* latency) { |
| 514 return make_scoped_ptr( | 521 return make_scoped_ptr( |
| 515 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 522 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
| 516 } | 523 } |
| 517 | 524 |
| 525 ScrollElasticityControllerClient* |
| 526 LayerTreeHostImpl::GetScrollElasticityControllerClient() { |
| 527 return scroll_elasticity_client_.get(); |
| 528 } |
| 529 |
| 518 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( | 530 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( |
| 519 scoped_ptr<SwapPromise> swap_promise) { | 531 scoped_ptr<SwapPromise> swap_promise) { |
| 520 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); | 532 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); |
| 521 } | 533 } |
| 522 | 534 |
| 523 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 535 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
| 524 LayerImpl* root_draw_layer, | 536 LayerImpl* root_draw_layer, |
| 525 const LayerImplList& render_surface_layer_list) { | 537 const LayerImplList& render_surface_layer_list) { |
| 526 // For now, we use damage tracking to compute a global scissor. To do this, we | 538 // For now, we use damage tracking to compute a global scissor. To do this, we |
| 527 // must compute all damage tracking before drawing anything, so that we know | 539 // must compute all damage tracking before drawing anything, so that we know |
| (...skipping 2986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 } | 3526 } |
| 3515 | 3527 |
| 3516 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3528 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3517 std::vector<PictureLayerImpl*>::iterator it = | 3529 std::vector<PictureLayerImpl*>::iterator it = |
| 3518 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3530 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3519 DCHECK(it != picture_layers_.end()); | 3531 DCHECK(it != picture_layers_.end()); |
| 3520 picture_layers_.erase(it); | 3532 picture_layers_.erase(it); |
| 3521 } | 3533 } |
| 3522 | 3534 |
| 3523 } // namespace cc | 3535 } // namespace cc |
| OLD | NEW |