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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 recycle_tree_->Shutdown(); | 271 recycle_tree_->Shutdown(); |
272 if (pending_tree_) | 272 if (pending_tree_) |
273 pending_tree_->Shutdown(); | 273 pending_tree_->Shutdown(); |
274 active_tree_->Shutdown(); | 274 active_tree_->Shutdown(); |
275 recycle_tree_ = nullptr; | 275 recycle_tree_ = nullptr; |
276 pending_tree_ = nullptr; | 276 pending_tree_ = nullptr; |
277 active_tree_ = nullptr; | 277 active_tree_ = nullptr; |
278 DestroyTileManager(); | 278 DestroyTileManager(); |
279 } | 279 } |
280 | 280 |
281 void LayerTreeHostImpl::BeginMainFrameAborted(bool did_handle) { | 281 void LayerTreeHostImpl::BeginMainFrameAborted(CommitEarlyOutReason reason) { |
282 // If the begin frame data was handled, then scroll and scale set was applied | 282 // If the begin frame data was handled, then scroll and scale set was applied |
283 // by the main thread, so the active tree needs to be updated as if these sent | 283 // by the main thread, so the active tree needs to be updated as if these sent |
284 // values were applied and committed. | 284 // values were applied and committed. |
285 if (did_handle) { | 285 if (CommitEarlyOutHandledCommit(reason)) { |
286 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); | 286 active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); |
287 active_tree_->ResetContentsTexturesPurged(); | 287 active_tree_->ResetContentsTexturesPurged(); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 void LayerTreeHostImpl::BeginCommit() { | 291 void LayerTreeHostImpl::BeginCommit() { |
292 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); | 292 TRACE_EVENT0("cc", "LayerTreeHostImpl::BeginCommit"); |
293 | 293 |
294 if (UsePendingTreeForSync()) | 294 if (UsePendingTreeForSync()) |
295 CreatePendingTree(); | 295 CreatePendingTree(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 | 467 |
468 scoped_ptr<SwapPromiseMonitor> | 468 scoped_ptr<SwapPromiseMonitor> |
469 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 469 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
470 ui::LatencyInfo* latency) { | 470 ui::LatencyInfo* latency) { |
471 return make_scoped_ptr( | 471 return make_scoped_ptr( |
472 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 472 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
473 } | 473 } |
474 | 474 |
475 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { | 475 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { |
476 DCHECK(!scroll_elasticity_helper_); | 476 DCHECK(!scroll_elasticity_helper_); |
477 scroll_elasticity_helper_.reset(new ScrollElasticityHelper(this)); | 477 scroll_elasticity_helper_.reset( |
| 478 ScrollElasticityHelper::CreateForLayerTreeHostImpl(this)); |
478 return scroll_elasticity_helper_.get(); | 479 return scroll_elasticity_helper_.get(); |
479 } | 480 } |
480 | 481 |
481 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( | 482 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( |
482 scoped_ptr<SwapPromise> swap_promise) { | 483 scoped_ptr<SwapPromise> swap_promise) { |
483 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); | 484 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); |
484 } | 485 } |
485 | 486 |
486 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 487 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
487 LayerImpl* root_draw_layer, | 488 LayerImpl* root_draw_layer, |
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 const gfx::Vector2dF& scroll_delta) const { | 2558 const gfx::Vector2dF& scroll_delta) const { |
2558 DCHECK(CurrentlyScrollingLayer()); | 2559 DCHECK(CurrentlyScrollingLayer()); |
2559 | 2560 |
2560 if (!top_controls_manager_) | 2561 if (!top_controls_manager_) |
2561 return false; | 2562 return false; |
2562 | 2563 |
2563 // Always consume if it's in the direction to show the top controls. | 2564 // Always consume if it's in the direction to show the top controls. |
2564 if (scroll_delta.y() < 0) | 2565 if (scroll_delta.y() < 0) |
2565 return true; | 2566 return true; |
2566 | 2567 |
2567 if (CurrentlyScrollingLayer() != InnerViewportScrollLayer() && | |
2568 CurrentlyScrollingLayer() != OuterViewportScrollLayer()) | |
2569 return false; | |
2570 | |
2571 if (active_tree()->TotalScrollOffset().y() < | 2568 if (active_tree()->TotalScrollOffset().y() < |
2572 active_tree()->TotalMaxScrollOffset().y()) | 2569 active_tree()->TotalMaxScrollOffset().y()) |
2573 return true; | 2570 return true; |
2574 | 2571 |
2575 return false; | 2572 return false; |
2576 } | 2573 } |
2577 | 2574 |
2578 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( | 2575 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
2579 const gfx::Point& viewport_point, | 2576 const gfx::Point& viewport_point, |
2580 const gfx::Vector2dF& scroll_delta) { | 2577 const gfx::Vector2dF& scroll_delta) { |
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3481 } | 3478 } |
3482 | 3479 |
3483 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3480 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3484 std::vector<PictureLayerImpl*>::iterator it = | 3481 std::vector<PictureLayerImpl*>::iterator it = |
3485 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3482 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3486 DCHECK(it != picture_layers_.end()); | 3483 DCHECK(it != picture_layers_.end()); |
3487 picture_layers_.erase(it); | 3484 picture_layers_.erase(it); |
3488 } | 3485 } |
3489 | 3486 |
3490 } // namespace cc | 3487 } // namespace cc |
OLD | NEW |