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

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: Build fix. 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
« 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 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);
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_->ResetCurrentBeginFrameArgsForNextFrame();
175 } 175 }
176 176
177 void SetActive(bool active) { 177 void SetActive(bool active) {
178 if (active != time_source_->Active()) 178 if (active != time_source_->Active())
179 time_source_->SetActive(active); 179 time_source_->SetActive(active);
180 } 180 }
181 181
182 bool Active() const { return time_source_->Active(); } 182 bool Active() const { return time_source_->Active(); }
183 183
184 private: 184 private:
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { 1670 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) {
1671 if (output_surface_) 1671 if (output_surface_)
1672 output_surface_->SetNeedsBeginFrame(enable); 1672 output_surface_->SetNeedsBeginFrame(enable);
1673 else 1673 else
1674 DCHECK(!enable); 1674 DCHECK(!enable);
1675 } 1675 }
1676 1676
1677 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1677 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1678 // Sample the frame time now. This time will be used for updating animations 1678 // Sample the frame time now. This time will be used for updating animations
1679 // when we draw. 1679 // when we draw.
1680 UpdateCurrentFrameTime(); 1680 UpdateCurrentBeginFrameArgs(args);
1681 // Cache the begin impl frame interval 1681 // Cache the begin impl frame interval
1682 begin_impl_frame_interval_ = args.interval; 1682 begin_impl_frame_interval_ = args.interval;
1683 } 1683 }
1684 1684
1685 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { 1685 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const {
1686 gfx::SizeF dip_size = 1686 gfx::SizeF dip_size =
1687 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor()); 1687 gfx::ScaleSize(device_viewport_size_, 1.f / device_scale_factor());
1688 1688
1689 float top_offset = 1689 float top_offset =
1690 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f; 1690 top_controls_manager_ ? top_controls_manager_->content_top_offset() : 0.f;
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 if (!animation) 2389 if (!animation)
2390 return ScrollIgnored; 2390 return ScrollIgnored;
2391 2391
2392 ScrollOffsetAnimationCurve* curve = 2392 ScrollOffsetAnimationCurve* curve =
2393 animation->curve()->ToScrollOffsetAnimationCurve(); 2393 animation->curve()->ToScrollOffsetAnimationCurve();
2394 2394
2395 gfx::Vector2dF new_target = curve->target_value() + scroll_delta; 2395 gfx::Vector2dF new_target = curve->target_value() + scroll_delta;
2396 new_target.SetToMax(gfx::Vector2dF()); 2396 new_target.SetToMax(gfx::Vector2dF());
2397 new_target.SetToMin(layer_impl->MaxScrollOffset()); 2397 new_target.SetToMin(layer_impl->MaxScrollOffset());
2398 2398
2399 curve->UpdateTarget( 2399 curve->UpdateTarget(animation->TrimTimeToCurrentIteration(
2400 animation->TrimTimeToCurrentIteration(CurrentFrameTimeTicks()), 2400 CurrentBeginFrameArgs().frame_time),
2401 new_target); 2401 new_target);
2402 2402
2403 return ScrollStarted; 2403 return ScrollStarted;
2404 } 2404 }
2405 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling 2405 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling
2406 // behavior as ScrollBy to determine which layer to animate, but we do not 2406 // behavior as ScrollBy to determine which layer to animate, but we do not
2407 // do the Android-specific things in ScrollBy like showing top controls. 2407 // do the Android-specific things in ScrollBy like showing top controls.
2408 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); 2408 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel);
2409 if (scroll_status == ScrollStarted) { 2409 if (scroll_status == ScrollStarted) {
2410 gfx::Vector2dF pending_delta = scroll_delta; 2410 gfx::Vector2dF pending_delta = scroll_delta;
2411 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; 2411 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { 3164 void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
3165 if (!tile_manager_) 3165 if (!tile_manager_)
3166 return; 3166 return;
3167 3167
3168 if (global_tile_state_.tree_priority == priority) 3168 if (global_tile_state_.tree_priority == priority)
3169 return; 3169 return;
3170 global_tile_state_.tree_priority = priority; 3170 global_tile_state_.tree_priority = priority;
3171 DidModifyTilePriorities(); 3171 DidModifyTilePriorities();
3172 } 3172 }
3173 3173
3174 void LayerTreeHostImpl::UpdateCurrentFrameTime() { 3174 void LayerTreeHostImpl::UpdateCurrentBeginFrameArgs(
3175 DCHECK(current_frame_timeticks_.is_null()); 3175 const BeginFrameArgs& args) {
3176 current_frame_timeticks_ = gfx::FrameTime::Now(); 3176 DCHECK(!current_begin_frame_args_.IsValid());
3177 current_begin_frame_args_ = args;
3178 // TODO(skyostil): Stop overriding the frame time once the usage of frame
3179 // timing is unified.
3180 current_begin_frame_args_.frame_time = gfx::FrameTime::Now();
3177 } 3181 }
3178 3182
3179 void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() { 3183 void LayerTreeHostImpl::ResetCurrentBeginFrameArgsForNextFrame() {
3180 current_frame_timeticks_ = base::TimeTicks(); 3184 current_begin_frame_args_ = BeginFrameArgs();
3181 } 3185 }
3182 3186
3183 base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() { 3187 BeginFrameArgs LayerTreeHostImpl::CurrentBeginFrameArgs() const {
3184 // Try to use the current frame time to keep animations non-jittery. But if 3188 // Try to use the current frame time to keep animations non-jittery. But if
3185 // we're not in a frame (because this is during an input event or a delayed 3189 // we're not in a frame (because this is during an input event or a delayed
3186 // task), fall back to physical time. This should still be monotonic. 3190 // task), fall back to physical time. This should still be monotonic.
3187 if (!current_frame_timeticks_.is_null()) 3191 if (current_begin_frame_args_.IsValid())
3188 return current_frame_timeticks_; 3192 return current_begin_frame_args_;
3189 return gfx::FrameTime::Now(); 3193 return BeginFrameArgs::Create(gfx::FrameTime::Now(),
3194 base::TimeTicks(),
3195 BeginFrameArgs::DefaultInterval());
3190 } 3196 }
3191 3197
3192 scoped_refptr<base::debug::ConvertableToTraceFormat> 3198 scoped_refptr<base::debug::ConvertableToTraceFormat>
3193 LayerTreeHostImpl::AsValue() const { 3199 LayerTreeHostImpl::AsValue() const {
3194 return AsValueWithFrame(NULL); 3200 return AsValueWithFrame(NULL);
3195 } 3201 }
3196 3202
3197 scoped_refptr<base::debug::ConvertableToTraceFormat> 3203 scoped_refptr<base::debug::ConvertableToTraceFormat>
3198 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { 3204 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const {
3199 scoped_refptr<base::debug::TracedValue> state = 3205 scoped_refptr<base::debug::TracedValue> state =
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3406 } 3412 }
3407 3413
3408 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3414 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3409 std::vector<PictureLayerImpl*>::iterator it = 3415 std::vector<PictureLayerImpl*>::iterator it =
3410 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3416 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3411 DCHECK(it != picture_layers_.end()); 3417 DCHECK(it != picture_layers_.end());
3412 picture_layers_.erase(it); 3418 picture_layers_.erase(it);
3413 } 3419 }
3414 3420
3415 } // namespace cc 3421 } // 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