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

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

Issue 429743003: Rename Animate as Begin(Main)Frame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a typo that made tests fail. Created 6 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 | Annotate | Revision Log
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 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // this in multi-threaded mode since the real thread id's will be 154 // this in multi-threaded mode since the real thread id's will be
155 // correct. In fact, setting fake thread id's interferes with the real 155 // correct. In fact, setting fake thread id's interferes with the real
156 // thread id's and causes breakage. 156 // thread id's and causes breakage.
157 scoped_ptr<DebugScopedSetImplThread> set_impl_thread; 157 scoped_ptr<DebugScopedSetImplThread> set_impl_thread;
158 if (!layer_tree_host_impl_->proxy()->HasImplThread()) { 158 if (!layer_tree_host_impl_->proxy()->HasImplThread()) {
159 set_impl_thread.reset( 159 set_impl_thread.reset(
160 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); 160 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy()));
161 } 161 }
162 162
163 layer_tree_host_impl_->Animate( 163 layer_tree_host_impl_->Animate(
164 layer_tree_host_impl_->CurrentFrameTimeTicks()); 164 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
mithro-old 2014/08/11 07:33:33 An example of the Animate verse BeginFrame here?
Sami 2014/08/11 17:51:26 We chatted about this and came to the conclusion t
165 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true); 165 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true);
166 bool start_ready_animations = true; 166 bool start_ready_animations = true;
167 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); 167 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
168 168
169 if (layer_tree_host_impl_->pending_tree()) { 169 if (layer_tree_host_impl_->pending_tree()) {
170 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); 170 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties();
171 layer_tree_host_impl_->ManageTiles(); 171 layer_tree_host_impl_->ManageTiles();
172 } 172 }
173 173
174 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); 174 layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame();
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { 1665 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) {
1666 if (output_surface_) 1666 if (output_surface_)
1667 output_surface_->SetNeedsBeginFrame(enable); 1667 output_surface_->SetNeedsBeginFrame(enable);
1668 else 1668 else
1669 DCHECK(!enable); 1669 DCHECK(!enable);
1670 } 1670 }
1671 1671
1672 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1672 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1673 // Sample the frame time now. This time will be used for updating animations 1673 // Sample the frame time now. This time will be used for updating animations
1674 // when we draw. 1674 // when we draw.
1675 UpdateCurrentFrameTime(); 1675 UpdateCurrentFrameTime(args);
1676 // Cache the begin impl frame interval 1676 // Cache the begin impl frame interval
1677 begin_impl_frame_interval_ = args.interval; 1677 begin_impl_frame_interval_ = args.interval;
mithro-old 2014/08/11 07:33:33 Should we log a bug to remove this value now it's
Sami 2014/08/11 17:51:26 It doesn't look like it's completely redundant sin
1678 } 1678 }
1679 1679
1680 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { 1680 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const {
1681 gfx::SizeF dip_size = 1681 gfx::SizeF dip_size =
1682 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); 1682 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor());
1683 1683
1684 float top_offset = 1684 float top_offset =
1685 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; 1685 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f;
1686 1686
1687 return gfx::SizeF(dip_size.width(), 1687 return gfx::SizeF(dip_size.width(),
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 if (!animation) 2386 if (!animation)
2387 return ScrollIgnored; 2387 return ScrollIgnored;
2388 2388
2389 ScrollOffsetAnimationCurve* curve = 2389 ScrollOffsetAnimationCurve* curve =
2390 animation->curve()->ToScrollOffsetAnimationCurve(); 2390 animation->curve()->ToScrollOffsetAnimationCurve();
2391 2391
2392 gfx::Vector2dF new_target = curve->target_value() + scroll_delta; 2392 gfx::Vector2dF new_target = curve->target_value() + scroll_delta;
2393 new_target.SetToMax(gfx::Vector2dF()); 2393 new_target.SetToMax(gfx::Vector2dF());
2394 new_target.SetToMin(layer_impl->MaxScrollOffset()); 2394 new_target.SetToMin(layer_impl->MaxScrollOffset());
2395 2395
2396 curve->UpdateTarget( 2396 curve->UpdateTarget(animation->TrimTimeToCurrentIteration(
2397 animation->TrimTimeToCurrentIteration(CurrentFrameTimeTicks()), 2397 CurrentBeginFrameArgs().frame_time),
2398 new_target); 2398 new_target);
2399 2399
2400 return ScrollStarted; 2400 return ScrollStarted;
2401 } 2401 }
2402 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling 2402 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling
2403 // behavior as ScrollBy to determine which layer to animate, but we do not 2403 // behavior as ScrollBy to determine which layer to animate, but we do not
2404 // do the Android-specific things in ScrollBy like showing top controls. 2404 // do the Android-specific things in ScrollBy like showing top controls.
2405 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); 2405 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel);
2406 if (scroll_status == ScrollStarted) { 2406 if (scroll_status == ScrollStarted) {
2407 gfx::Vector2dF pending_delta = scroll_delta; 2407 gfx::Vector2dF pending_delta = scroll_delta;
2408 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; 2408 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { 3147 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
3148 if (!tile_manager_) 3148 if (!tile_manager_)
3149 return; 3149 return;
3150 3150
3151 if (global_tile_state_.tree_priority == priority) 3151 if (global_tile_state_.tree_priority == priority)
3152 return; 3152 return;
3153 global_tile_state_.tree_priority = priority; 3153 global_tile_state_.tree_priority = priority;
3154 DidModifyTilePriorities(); 3154 DidModifyTilePriorities();
3155 } 3155 }
3156 3156
3157 void LayerTreeHostImpl::UpdateCurrentFrameTime() { 3157 void LayerTreeHostImpl::UpdateCurrentFrameTime(const BeginFrameArgs& args) {
mithro-old 2014/08/11 07:33:33 UpdateCurrentFrameTime previously didn't take argu
Sami 2014/08/11 17:51:26 Now that this is called UpdateCurrentBeginFrameArg
3158 DCHECK(current_frame_timeticks_.is_null()); 3158 DCHECK(!current_begin_frame_args_.IsValid());
3159 current_frame_timeticks_ = gfx::FrameTime::Now(); 3159 current_begin_frame_args_ = args;
3160 current_begin_frame_args_.frame_time = gfx::FrameTime::Now();
mithro-old 2014/08/11 07:33:33 Can we add a comment about this now usage. It's go
Sami 2014/08/11 17:51:26 Can you suggest something to write, because I don'
3160 } 3161 }
3161 3162
3162 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() { 3163 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() {
3163 current_frame_timeticks_ = base::TimeTicks(); 3164 current_begin_frame_args_ = BeginFrameArgs();
3164 } 3165 }
3165 3166
3166 base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() { 3167 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const {
3167 // Try to use the current frame time to keep animations non-jittery. But if 3168 // Try to use the current frame time to keep animations non-jittery. But if
3168 // we're not in a frame (because this is during an input event or a delayed 3169 // we're not in a frame (because this is during an input event or a delayed
3169 // task), fall back to physical time. This should still be monotonic. 3170 // task), fall back to physical time. This should still be monotonic.
3170 if (!current_frame_timeticks_.is_null()) 3171 if (current_begin_frame_args_.IsValid())
3171 return current_frame_timeticks_; 3172 return current_begin_frame_args_;
3172 return gfx::FrameTime::Now(); 3173 return BeginFrameArgs::Create(gfx::FrameTime::Now(),
3174 base::TimeTicks(),
3175 BeginFrameArgs::DefaultInterval());
mithro-old 2014/08/11 07:33:33 I'm still trying to make this go away :(
3173 } 3176 }
3174 3177
3175 scoped_refptr<base::debug::ConvertableToTraceFormat> 3178 scoped_refptr<base::debug::ConvertableToTraceFormat>
3176 LayerTreeHostImpl::AsValue() const { 3179 LayerTreeHostImpl::AsValue() const {
3177 return AsValueWithFrame(NULL); 3180 return AsValueWithFrame(NULL);
3178 } 3181 }
3179 3182
3180 scoped_refptr<base::debug::ConvertableToTraceFormat> 3183 scoped_refptr<base::debug::ConvertableToTraceFormat>
3181 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { 3184 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const {
3182 scoped_refptr<base::debug::TracedValue> state = 3185 scoped_refptr<base::debug::TracedValue> state =
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 } 3374 }
3372 3375
3373 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3376 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3374 std::vector<PictureLayerImpl*>::iterator it = 3377 std::vector<PictureLayerImpl*>::iterator it =
3375 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3378 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3376 DCHECK(it != picture_layers_.end()); 3379 DCHECK(it != picture_layers_.end());
3377 picture_layers_.erase(it); 3380 picture_layers_.erase(it);
3378 } 3381 }
3379 3382
3380 } // namespace cc 3383 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698