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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "cc/resources/raster_worker_pool.h" | 58 #include "cc/resources/raster_worker_pool.h" |
59 #include "cc/resources/resource_pool.h" | 59 #include "cc/resources/resource_pool.h" |
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/layer_tree_scroll_elasticity_client.h" |
68 #include "cc/trees/occlusion_tracker.h" | 69 #include "cc/trees/occlusion_tracker.h" |
69 #include "cc/trees/single_thread_proxy.h" | 70 #include "cc/trees/single_thread_proxy.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 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 LayerTreeHostImpl::~LayerTreeHostImpl() { | 275 LayerTreeHostImpl::~LayerTreeHostImpl() { |
275 DCHECK(proxy_->IsImplThread()); | 276 DCHECK(proxy_->IsImplThread()); |
276 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 277 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
277 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 278 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
278 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 279 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
279 | 280 |
280 if (input_handler_client_) { | 281 if (input_handler_client_) { |
281 input_handler_client_->WillShutdown(); | 282 input_handler_client_->WillShutdown(); |
282 input_handler_client_ = NULL; | 283 input_handler_client_ = NULL; |
283 } | 284 } |
| 285 if (scroll_elasticity_client_) |
| 286 scroll_elasticity_client_.reset(); |
284 | 287 |
285 // The layer trees must be destroyed before the layer tree host. We've | 288 // The layer trees must be destroyed before the layer tree host. We've |
286 // made a contract with our animation controllers that the registrar | 289 // made a contract with our animation controllers that the registrar |
287 // will outlive them, and we must make good. | 290 // will outlive them, and we must make good. |
288 if (recycle_tree_) | 291 if (recycle_tree_) |
289 recycle_tree_->Shutdown(); | 292 recycle_tree_->Shutdown(); |
290 if (pending_tree_) | 293 if (pending_tree_) |
291 pending_tree_->Shutdown(); | 294 pending_tree_->Shutdown(); |
292 active_tree_->Shutdown(); | 295 active_tree_->Shutdown(); |
293 recycle_tree_ = nullptr; | 296 recycle_tree_ = nullptr; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", | 390 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
388 TRACE_EVENT_SCOPE_THREAD); | 391 TRACE_EVENT_SCOPE_THREAD); |
389 return false; | 392 return false; |
390 } | 393 } |
391 return true; | 394 return true; |
392 } | 395 } |
393 | 396 |
394 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { | 397 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { |
395 if (input_handler_client_) | 398 if (input_handler_client_) |
396 input_handler_client_->Animate(monotonic_time); | 399 input_handler_client_->Animate(monotonic_time); |
| 400 if (scroll_elasticity_client_) |
| 401 scroll_elasticity_client_->Animate(monotonic_time); |
397 AnimatePageScale(monotonic_time); | 402 AnimatePageScale(monotonic_time); |
398 AnimateLayers(monotonic_time); | 403 AnimateLayers(monotonic_time); |
399 AnimateScrollbars(monotonic_time); | 404 AnimateScrollbars(monotonic_time); |
400 AnimateTopControls(monotonic_time); | 405 AnimateTopControls(monotonic_time); |
401 } | 406 } |
402 | 407 |
403 void LayerTreeHostImpl::ManageTiles() { | 408 void LayerTreeHostImpl::ManageTiles() { |
404 if (!tile_manager_) | 409 if (!tile_manager_) |
405 return; | 410 return; |
406 if (!tile_priorities_dirty_) | 411 if (!tile_priorities_dirty_) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 return layer_impl != NULL; | 448 return layer_impl != NULL; |
444 } | 449 } |
445 | 450 |
446 scoped_ptr<SwapPromiseMonitor> | 451 scoped_ptr<SwapPromiseMonitor> |
447 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 452 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
448 ui::LatencyInfo* latency) { | 453 ui::LatencyInfo* latency) { |
449 return make_scoped_ptr( | 454 return make_scoped_ptr( |
450 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 455 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
451 } | 456 } |
452 | 457 |
| 458 ScrollElasticityControllerClient* |
| 459 LayerTreeHostImpl::GetScrollElasticityControllerClient() { |
| 460 if (!scroll_elasticity_client_) |
| 461 scroll_elasticity_client_.reset(new LayerTreeScrollElasticityClient(this)); |
| 462 return scroll_elasticity_client_.get(); |
| 463 } |
| 464 |
453 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( | 465 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( |
454 scoped_ptr<SwapPromise> swap_promise) { | 466 scoped_ptr<SwapPromise> swap_promise) { |
455 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); | 467 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); |
456 } | 468 } |
457 | 469 |
458 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 470 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
459 LayerImpl* root_draw_layer, | 471 LayerImpl* root_draw_layer, |
460 const LayerImplList& render_surface_layer_list) { | 472 const LayerImplList& render_surface_layer_list) { |
461 // For now, we use damage tracking to compute a global scissor. To do this, we | 473 // For now, we use damage tracking to compute a global scissor. To do this, we |
462 // must compute all damage tracking before drawing anything, so that we know | 474 // must compute all damage tracking before drawing anything, so that we know |
(...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3422 } | 3434 } |
3423 | 3435 |
3424 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3436 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3425 std::vector<PictureLayerImpl*>::iterator it = | 3437 std::vector<PictureLayerImpl*>::iterator it = |
3426 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3438 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3427 DCHECK(it != picture_layers_.end()); | 3439 DCHECK(it != picture_layers_.end()); |
3428 picture_layers_.erase(it); | 3440 picture_layers_.erase(it); |
3429 } | 3441 } |
3430 | 3442 |
3431 } // namespace cc | 3443 } // namespace cc |
OLD | NEW |