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

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

Issue 1127963003: Revert of cc: Adding DidFinishImplFrame to LTHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 0, 0); 1664 0, 0);
1665 } 1665 }
1666 } 1666 }
1667 renderer_->SwapBuffers(metadata); 1667 renderer_->SwapBuffers(metadata);
1668 return true; 1668 return true;
1669 } 1669 }
1670 1670
1671 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1671 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1672 // Sample the frame time now. This time will be used for updating animations 1672 // Sample the frame time now. This time will be used for updating animations
1673 // when we draw. 1673 // when we draw.
1674 DCHECK(!current_begin_frame_args_.IsValid()); 1674 UpdateCurrentBeginFrameArgs(args);
1675 current_begin_frame_args_ = args;
1676 // TODO(mithro): Stop overriding the frame time once the usage of frame
1677 // timing is unified.
1678 current_begin_frame_args_.frame_time = gfx::FrameTime::Now();
1679
1680 // Cache the begin impl frame interval 1675 // Cache the begin impl frame interval
1681 begin_impl_frame_interval_ = args.interval; 1676 begin_impl_frame_interval_ = args.interval;
1682 1677
1683 if (is_likely_to_require_a_draw_) { 1678 if (is_likely_to_require_a_draw_) {
1684 // Optimistically schedule a draw. This will let us expect the tile manager 1679 // Optimistically schedule a draw. This will let us expect the tile manager
1685 // to complete its work so that we can draw new tiles within the impl frame 1680 // to complete its work so that we can draw new tiles within the impl frame
1686 // we are beginning now. 1681 // we are beginning now.
1687 SetNeedsRedraw(); 1682 SetNeedsRedraw();
1688 } 1683 }
1689 1684
1690 for (auto& it : video_frame_controllers_) 1685 for (auto& it : video_frame_controllers_)
1691 it->OnBeginFrame(args); 1686 it->OnBeginFrame(args);
1692 } 1687 }
1693 1688
1694 void LayerTreeHostImpl::DidFinishImplFrame() {
1695 DCHECK(current_begin_frame_args_.IsValid());
1696 current_begin_frame_args_ = BeginFrameArgs();
1697 }
1698
1699 void LayerTreeHostImpl::UpdateViewportContainerSizes() { 1689 void LayerTreeHostImpl::UpdateViewportContainerSizes() {
1700 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); 1690 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer();
1701 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer(); 1691 LayerImpl* outer_container = active_tree_->OuterViewportContainerLayer();
1702 1692
1703 if (!inner_container) 1693 if (!inner_container)
1704 return; 1694 return;
1705 1695
1706 // TODO(bokan): This code is currently specific to top controls. It should be 1696 // TODO(bokan): This code is currently specific to top controls. It should be
1707 // made general. crbug.com/464814. 1697 // made general. crbug.com/464814.
1708 if (!TopControlsHeight()) { 1698 if (!TopControlsHeight()) {
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
3136 if (global_tile_state_.tree_priority == priority) 3126 if (global_tile_state_.tree_priority == priority)
3137 return; 3127 return;
3138 global_tile_state_.tree_priority = priority; 3128 global_tile_state_.tree_priority = priority;
3139 DidModifyTilePriorities(); 3129 DidModifyTilePriorities();
3140 } 3130 }
3141 3131
3142 TreePriority LayerTreeHostImpl::GetTreePriority() const { 3132 TreePriority LayerTreeHostImpl::GetTreePriority() const {
3143 return global_tile_state_.tree_priority; 3133 return global_tile_state_.tree_priority;
3144 } 3134 }
3145 3135
3136 void LayerTreeHostImpl::UpdateCurrentBeginFrameArgs(
3137 const BeginFrameArgs& args) {
3138 DCHECK(!current_begin_frame_args_.IsValid());
3139 current_begin_frame_args_ = args;
3140 // TODO(skyostil): Stop overriding the frame time once the usage of frame
3141 // timing is unified.
3142 current_begin_frame_args_.frame_time = gfx::FrameTime::Now();
3143 }
3144
3145 void LayerTreeHostImpl::ResetCurrentBeginFrameArgsForNextFrame() {
3146 current_begin_frame_args_ = BeginFrameArgs();
3147 }
3148
3146 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const { 3149 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const {
3147 // Try to use the current frame time to keep animations non-jittery. But if 3150 // Try to use the current frame time to keep animations non-jittery. But if
3148 // we're not in a frame (because this is during an input event or a delayed 3151 // we're not in a frame (because this is during an input event or a delayed
3149 // task), fall back to physical time. This should still be monotonic. 3152 // task), fall back to physical time. This should still be monotonic.
3150 if (current_begin_frame_args_.IsValid()) 3153 if (current_begin_frame_args_.IsValid())
3151 return current_begin_frame_args_; 3154 return current_begin_frame_args_;
3152 return BeginFrameArgs::Create( 3155 return BeginFrameArgs::Create(
3153 BEGINFRAME_FROM_HERE, gfx::FrameTime::Now(), base::TimeTicks(), 3156 BEGINFRAME_FROM_HERE, gfx::FrameTime::Now(), base::TimeTicks(),
3154 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL); 3157 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::NORMAL);
3155 } 3158 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
3395 new_target.SetToMin(layer_impl->MaxScrollOffset()); 3398 new_target.SetToMin(layer_impl->MaxScrollOffset());
3396 3399
3397 curve->UpdateTarget( 3400 curve->UpdateTarget(
3398 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) 3401 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time)
3399 .InSecondsF(), 3402 .InSecondsF(),
3400 new_target); 3403 new_target);
3401 3404
3402 return true; 3405 return true;
3403 } 3406 }
3404 } // namespace cc 3407 } // 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