Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl.cc |
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
| index d4c48f9c9e624fc1ce5309d4f45251aee8e12260..3101eba4ca0cb9554f3f20247245ad2da3781a18 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -167,12 +167,15 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { |
| layer_tree_host_impl_->ManageTiles(); |
| } |
| + // TODO(mithro): Change to using something like |
| + // OnBackgroundFrame(BeginFrameArgs xxx) |
| + layer_tree_host_impl_->OverrideCurrentFrameTime( |
|
danakj
2014/03/11 18:32:36
This should be above UpdateDrawProps/ManageTiles.
|
| + time_source_->LastTickTime()); |
| layer_tree_host_impl_->Animate( |
| layer_tree_host_impl_->CurrentFrameTimeTicks()); |
| layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true); |
| bool start_ready_animations = true; |
| layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
| - layer_tree_host_impl_->ResetCurrentFrameTimeForNextFrame(); |
| } |
| void SetActive(bool active) { |
| @@ -1290,6 +1293,9 @@ void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
| } |
| void LayerTreeHostImpl::BeginImplFrame(const BeginFrameArgs& args) { |
| + last_frame_args_ = current_frame_args_; |
| + current_frame_args_ = args; |
| + |
| client_->BeginImplFrame(args); |
| } |
| @@ -2470,8 +2476,7 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| scroll_layer_impl ? scroll_layer_impl->scrollbar_animation_controller() |
| : NULL; |
| if (animation_controller) { |
| - animation_controller->DidMouseMoveOffScrollbar( |
| - CurrentPhysicalTimeTicks()); |
| + animation_controller->DidMouseMoveOffScrollbar(CurrentFrameTimeTicks()); |
|
aelias_OOO_until_Jul13
2014/03/21 01:37:44
physical time
|
| StartScrollbarAnimation(); |
| } |
| scroll_layer_id_when_mouse_over_scrollbar_ = 0; |
| @@ -2499,8 +2504,9 @@ void LayerTreeHostImpl::MouseMoveAt(const gfx::Point& viewport_point) { |
| std::min(distance_to_scrollbar, |
| DeviceSpaceDistanceToLayer(device_viewport_point, *it)); |
| + // TODO(mithro): Show this be something other then frame time? |
| bool should_animate = animation_controller->DidMouseMoveNear( |
| - CurrentPhysicalTimeTicks(), distance_to_scrollbar / device_scale_factor_); |
| + CurrentFrameTimeTicks(), distance_to_scrollbar / device_scale_factor_); |
|
danakj
2014/03/11 18:32:36
What happens if you get input here and you're not
|
| if (should_animate) |
| StartScrollbarAnimation(); |
| } |
| @@ -2514,7 +2520,7 @@ bool LayerTreeHostImpl::HandleMouseOverScrollbar(LayerImpl* layer_impl, |
| scroll_layer_id_when_mouse_over_scrollbar_ = scroll_layer_id; |
| bool should_animate = |
| layer_impl->scrollbar_animation_controller()->DidMouseMoveNear( |
| - CurrentPhysicalTimeTicks(), 0); |
| + CurrentFrameTimeTicks(), 0); |
|
aelias_OOO_until_Jul13
2014/03/21 01:37:44
physical time
|
| if (should_animate) |
| StartScrollbarAnimation(); |
| } else { |
| @@ -2830,7 +2836,7 @@ void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer, |
| void LayerTreeHostImpl::StartScrollbarAnimation() { |
| TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation"); |
| - StartScrollbarAnimationRecursive(RootLayer(), CurrentPhysicalTimeTicks()); |
| + StartScrollbarAnimationRecursive(RootLayer(), CurrentFrameTimeTicks()); |
|
aelias_OOO_until_Jul13
2014/03/21 01:37:44
This is another thing I specifically changed to ph
|
| } |
| void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer, |
| @@ -2862,23 +2868,16 @@ void LayerTreeHostImpl::SetTreePriority(TreePriority priority) { |
| DidModifyTilePriorities(); |
| } |
| -void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() { |
| - current_frame_timeticks_ = base::TimeTicks(); |
| -} |
| - |
| -void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks) const { |
| - if (ticks->is_null()) { |
| - *ticks = CurrentPhysicalTimeTicks(); |
| - } |
| -} |
| - |
| -base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() { |
| - UpdateCurrentFrameTime(¤t_frame_timeticks_); |
| - return current_frame_timeticks_; |
| +void LayerTreeHostImpl::OverrideCurrentFrameTime(base::TimeTicks frame_time) { |
| + TRACE_EVENT1("cc", |
| + "LayerTreeHostImpl::OverrideCurrentFrameTime", |
| + "frame_time", |
| + frame_time.ToInternalValue()); |
| + current_frame_args_.frame_time = frame_time; |
| } |
| -base::TimeTicks LayerTreeHostImpl::CurrentPhysicalTimeTicks() const { |
| - return gfx::FrameTime::Now(); |
| +base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() const { |
| + return current_frame_args_.frame_time; |
| } |
| scoped_ptr<base::Value> LayerTreeHostImpl::AsValueWithFrame( |