| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 pending_tree_->ApplyScrollDeltasSinceBeginMainFrame(); | 302 pending_tree_->ApplyScrollDeltasSinceBeginMainFrame(); |
| 303 sync_tree()->set_needs_update_draw_properties(); | 303 sync_tree()->set_needs_update_draw_properties(); |
| 304 | 304 |
| 305 if (settings_.impl_side_painting) { | 305 if (settings_.impl_side_painting) { |
| 306 // Impl-side painting needs an update immediately post-commit to have the | 306 // Impl-side painting needs an update immediately post-commit to have the |
| 307 // opportunity to create tilings. Other paths can call UpdateDrawProperties | 307 // opportunity to create tilings. Other paths can call UpdateDrawProperties |
| 308 // more lazily when needed prior to drawing. | 308 // more lazily when needed prior to drawing. |
| 309 sync_tree()->UpdateDrawProperties(); | 309 sync_tree()->UpdateDrawProperties(); |
| 310 // Start working on newly created tiles immediately if needed. | 310 // Start working on newly created tiles immediately if needed. |
| 311 if (tile_manager_ && tile_priorities_dirty_) | 311 if (tile_manager_ && tile_priorities_dirty_) |
| 312 ManageTiles(); | 312 PrepareTiles(); |
| 313 else | 313 else |
| 314 NotifyReadyToActivate(); | 314 NotifyReadyToActivate(); |
| 315 } else { | 315 } else { |
| 316 // If we're not in impl-side painting, the tree is immediately considered | 316 // If we're not in impl-side painting, the tree is immediately considered |
| 317 // active. | 317 // active. |
| 318 ActivateSyncTree(); | 318 ActivateSyncTree(); |
| 319 } | 319 } |
| 320 | 320 |
| 321 micro_benchmark_controller_.DidCompleteCommit(); | 321 micro_benchmark_controller_.DidCompleteCommit(); |
| 322 } | 322 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { | 376 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { |
| 377 if (input_handler_client_) | 377 if (input_handler_client_) |
| 378 input_handler_client_->Animate(monotonic_time); | 378 input_handler_client_->Animate(monotonic_time); |
| 379 AnimatePageScale(monotonic_time); | 379 AnimatePageScale(monotonic_time); |
| 380 AnimateLayers(monotonic_time); | 380 AnimateLayers(monotonic_time); |
| 381 AnimateScrollbars(monotonic_time); | 381 AnimateScrollbars(monotonic_time); |
| 382 AnimateTopControls(monotonic_time); | 382 AnimateTopControls(monotonic_time); |
| 383 } | 383 } |
| 384 | 384 |
| 385 void LayerTreeHostImpl::ManageTiles() { | 385 void LayerTreeHostImpl::PrepareTiles() { |
| 386 if (!tile_manager_) | 386 if (!tile_manager_) |
| 387 return; | 387 return; |
| 388 if (!tile_priorities_dirty_) | 388 if (!tile_priorities_dirty_) |
| 389 return; | 389 return; |
| 390 | 390 |
| 391 tile_priorities_dirty_ = false; | 391 tile_priorities_dirty_ = false; |
| 392 tile_manager_->ManageTiles(global_tile_state_); | 392 tile_manager_->PrepareTiles(global_tile_state_); |
| 393 | 393 |
| 394 client_->DidManageTiles(); | 394 client_->DidPrepareTiles(); |
| 395 } | 395 } |
| 396 | 396 |
| 397 void LayerTreeHostImpl::StartPageScaleAnimation( | 397 void LayerTreeHostImpl::StartPageScaleAnimation( |
| 398 const gfx::Vector2d& target_offset, | 398 const gfx::Vector2d& target_offset, |
| 399 bool anchor_point, | 399 bool anchor_point, |
| 400 float page_scale, | 400 float page_scale, |
| 401 base::TimeDelta duration) { | 401 base::TimeDelta duration) { |
| 402 if (!InnerViewportScrollLayer()) | 402 if (!InnerViewportScrollLayer()) |
| 403 return; | 403 return; |
| 404 | 404 |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 std::numeric_limits<size_t>::max(), | 1179 std::numeric_limits<size_t>::max(), |
| 1180 std::numeric_limits<size_t>::max(), | 1180 std::numeric_limits<size_t>::max(), |
| 1181 visible_ ? GetMaxStagingResourceCount() : 0); | 1181 visible_ ? GetMaxStagingResourceCount() : 0); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 DidModifyTilePriorities(); | 1184 DidModifyTilePriorities(); |
| 1185 } | 1185 } |
| 1186 | 1186 |
| 1187 void LayerTreeHostImpl::DidModifyTilePriorities() { | 1187 void LayerTreeHostImpl::DidModifyTilePriorities() { |
| 1188 DCHECK(settings_.impl_side_painting); | 1188 DCHECK(settings_.impl_side_painting); |
| 1189 // Mark priorities as dirty and schedule a ManageTiles(). | 1189 // Mark priorities as dirty and schedule a PrepareTiles(). |
| 1190 tile_priorities_dirty_ = true; | 1190 tile_priorities_dirty_ = true; |
| 1191 client_->SetNeedsManageTilesOnImplThread(); | 1191 client_->SetNeedsPrepareTilesOnImplThread(); |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 void LayerTreeHostImpl::GetPictureLayerImplPairs( | 1194 void LayerTreeHostImpl::GetPictureLayerImplPairs( |
| 1195 std::vector<PictureLayerImpl::Pair>* layer_pairs, | 1195 std::vector<PictureLayerImpl::Pair>* layer_pairs, |
| 1196 bool need_valid_tile_priorities) const { | 1196 bool need_valid_tile_priorities) const { |
| 1197 DCHECK(layer_pairs->empty()); | 1197 DCHECK(layer_pairs->empty()); |
| 1198 for (std::vector<PictureLayerImpl*>::const_iterator it = | 1198 for (std::vector<PictureLayerImpl*>::const_iterator it = |
| 1199 picture_layers_.begin(); | 1199 picture_layers_.begin(); |
| 1200 it != picture_layers_.end(); | 1200 it != picture_layers_.end(); |
| 1201 ++it) { | 1201 ++it) { |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1850 // If we just became visible, we have to ensure that we draw high res tiles, | 1850 // If we just became visible, we have to ensure that we draw high res tiles, |
| 1851 // to prevent checkerboard/low res flashes. | 1851 // to prevent checkerboard/low res flashes. |
| 1852 if (visible_) | 1852 if (visible_) |
| 1853 SetRequiresHighResToDraw(); | 1853 SetRequiresHighResToDraw(); |
| 1854 else | 1854 else |
| 1855 EvictAllUIResources(); | 1855 EvictAllUIResources(); |
| 1856 | 1856 |
| 1857 // Evict tiles immediately if invisible since this tab may never get another | 1857 // Evict tiles immediately if invisible since this tab may never get another |
| 1858 // draw or timer tick. | 1858 // draw or timer tick. |
| 1859 if (!visible_) | 1859 if (!visible_) |
| 1860 ManageTiles(); | 1860 PrepareTiles(); |
| 1861 | 1861 |
| 1862 if (!renderer_) | 1862 if (!renderer_) |
| 1863 return; | 1863 return; |
| 1864 | 1864 |
| 1865 renderer_->SetVisible(visible); | 1865 renderer_->SetVisible(visible); |
| 1866 } | 1866 } |
| 1867 | 1867 |
| 1868 void LayerTreeHostImpl::SetNeedsAnimate() { | 1868 void LayerTreeHostImpl::SetNeedsAnimate() { |
| 1869 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1869 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
| 1870 client_->SetNeedsAnimateOnImplThread(); | 1870 client_->SetNeedsAnimateOnImplThread(); |
| (...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3484 } | 3484 } |
| 3485 | 3485 |
| 3486 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3486 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
| 3487 std::vector<PictureLayerImpl*>::iterator it = | 3487 std::vector<PictureLayerImpl*>::iterator it = |
| 3488 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3488 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
| 3489 DCHECK(it != picture_layers_.end()); | 3489 DCHECK(it != picture_layers_.end()); |
| 3490 picture_layers_.erase(it); | 3490 picture_layers_.erase(it); |
| 3491 } | 3491 } |
| 3492 | 3492 |
| 3493 } // namespace cc | 3493 } // namespace cc |
| OLD | NEW |