Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 1297363004: cc: Move animate steps from proxies to LayerTreeHostImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moveanimatecodetolthi: . Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 414 }
415 if (EvictedUIResourcesExist()) { 415 if (EvictedUIResourcesExist()) {
416 TRACE_EVENT_INSTANT0( 416 TRACE_EVENT_INSTANT0(
417 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", 417 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated",
418 TRACE_EVENT_SCOPE_THREAD); 418 TRACE_EVENT_SCOPE_THREAD);
419 return false; 419 return false;
420 } 420 }
421 return true; 421 return true;
422 } 422 }
423 423
424 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { 424 void LayerTreeHostImpl::Animate() {
425 // Don't animate if there is no active root layer.
426 // TODO(ajuma): Does this break things if first commit has an animation?
ajuma 2015/08/19 21:05:02 I suspect it will if break things if we move post-
427 if (!active_tree()->root_layer())
428 return;
429
430 base::TimeTicks monotonic_time = CurrentBeginFrameArgs().frame_time;
431
425 // mithro(TODO): Enable these checks. 432 // mithro(TODO): Enable these checks.
426 // DCHECK(!current_begin_frame_tracker_.HasFinished()); 433 // DCHECK(!current_begin_frame_tracker_.HasFinished());
427 // DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time) 434 // DCHECK(monotonic_time == current_begin_frame_tracker_.Current().frame_time)
428 // << "Called animate with unknown frame time!?"; 435 // << "Called animate with unknown frame time!?";
429 if (!root_layer_scroll_offset_delegate_ || 436 if (!root_layer_scroll_offset_delegate_ ||
430 (CurrentlyScrollingLayer() != InnerViewportScrollLayer() && 437 (CurrentlyScrollingLayer() != InnerViewportScrollLayer() &&
431 CurrentlyScrollingLayer() != OuterViewportScrollLayer())) { 438 CurrentlyScrollingLayer() != OuterViewportScrollLayer()))
432 AnimateInput(monotonic_time); 439 AnimateInput(monotonic_time);
433 }
434 AnimatePageScale(monotonic_time); 440 AnimatePageScale(monotonic_time);
435 AnimateLayers(monotonic_time); 441 AnimateLayers(monotonic_time);
436 AnimateScrollbars(monotonic_time); 442 AnimateScrollbars(monotonic_time);
437 AnimateTopControls(monotonic_time); 443 AnimateTopControls(monotonic_time);
444
445 // If animations are not visible, update the state now as Draw/Swap will never
446 // occur.
447 // TODO(ajuma): Left-overs from now-deleted background ticking?
ajuma 2015/08/19 21:05:02 Sure looks like it.
448 bool animations_are_visible = visible() && CanDraw();
449 if (!animations_are_visible)
450 UpdateAnimationState(true);
438 } 451 }
439 452
440 bool LayerTreeHostImpl::PrepareTiles() { 453 bool LayerTreeHostImpl::PrepareTiles() {
441 if (!tile_priorities_dirty_) 454 if (!tile_priorities_dirty_)
442 return false; 455 return false;
443 456
444 client_->WillPrepareTiles(); 457 client_->WillPrepareTiles();
445 bool did_prepare_tiles = tile_manager_->PrepareTiles(global_tile_state_); 458 bool did_prepare_tiles = tile_manager_->PrepareTiles(global_tile_state_);
446 if (did_prepare_tiles) 459 if (did_prepare_tiles)
447 tile_priorities_dirty_ = false; 460 tile_priorities_dirty_ = false;
(...skipping 3194 matching lines...) Expand 10 before | Expand all | Expand 10 after
3642 if (active_tree()) { 3655 if (active_tree()) {
3643 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id); 3656 LayerAnimationValueProvider* layer = active_tree()->LayerById(layer_id);
3644 if (layer) 3657 if (layer)
3645 return layer->ScrollOffsetForAnimation(); 3658 return layer->ScrollOffsetForAnimation();
3646 } 3659 }
3647 3660
3648 return gfx::ScrollOffset(); 3661 return gfx::ScrollOffset();
3649 } 3662 }
3650 3663
3651 } // namespace cc 3664 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698