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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 178103004: Removing the use of base::Time inside the LayerTreeHost system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing to a common ToWebKitTime function. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
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 ec89ddcfd734a055a9cdc9fa4dd9bc60bc870f99..d6b369a9e63ceacffeaea2df9dd2ee631bba4ccb 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -167,8 +167,7 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
}
layer_tree_host_impl_->Animate(
- layer_tree_host_impl_->CurrentFrameTimeTicks(),
- layer_tree_host_impl_->CurrentFrameTime());
+ layer_tree_host_impl_->CurrentFrameTimeTicks());
layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true);
bool start_ready_animations = true;
layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
@@ -396,12 +395,11 @@ bool LayerTreeHostImpl::CanDraw() const {
return true;
}
-void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time,
- base::Time wall_clock_time) {
+void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
if (input_handler_client_)
input_handler_client_->Animate(monotonic_time);
AnimatePageScale(monotonic_time);
- AnimateLayers(monotonic_time, wall_clock_time);
+ AnimateLayers(monotonic_time);
AnimateScrollbars(monotonic_time);
AnimateTopControls(monotonic_time);
}
@@ -2610,22 +2608,22 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks time) {
if (!page_scale_animation_)
return;
- double monotonic_time = (time - base::TimeTicks()).InSecondsF();
+ double webkit_time = time.ToWebKit();
gfx::Vector2dF scroll_total = active_tree_->TotalScrollOffset();
if (!page_scale_animation_->IsAnimationStarted())
- page_scale_animation_->StartAnimation(monotonic_time);
+ page_scale_animation_->StartAnimation(webkit_time);
active_tree_->SetPageScaleDelta(
- page_scale_animation_->PageScaleFactorAtTime(monotonic_time) /
+ page_scale_animation_->PageScaleFactorAtTime(webkit_time) /
active_tree_->page_scale_factor());
gfx::Vector2dF next_scroll =
- page_scale_animation_->ScrollOffsetAtTime(monotonic_time);
+ page_scale_animation_->ScrollOffsetAtTime(webkit_time);
ScrollViewportBy(next_scroll - scroll_total);
SetNeedsRedraw();
- if (page_scale_animation_->IsAnimationCompleteAtTime(monotonic_time)) {
+ if (page_scale_animation_->IsAnimationCompleteAtTime(webkit_time)) {
page_scale_animation_.reset();
client_->SetNeedsCommitOnImplThread();
client_->RenewTreePriority();
@@ -2648,8 +2646,7 @@ void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
}
}
-void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time,
- base::Time wall_clock_time) {
+void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) {
if (!settings_.accelerated_animation_enabled ||
animation_registrar_->active_animation_controllers().empty() ||
!active_tree_->root_layer())
@@ -2657,15 +2654,12 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time,
TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers");
- last_animation_time_ = wall_clock_time;
- double monotonic_seconds = (monotonic_time - base::TimeTicks()).InSecondsF();
-
AnimationRegistrar::AnimationControllerMap copy =
animation_registrar_->active_animation_controllers();
for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin();
iter != copy.end();
++iter)
- (*iter).second->Animate(monotonic_seconds);
+ (*iter).second->Animate(monotonic_time.ToWebKit());
SetNeedsRedraw();
}
@@ -2823,28 +2817,19 @@ void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() {
current_frame_timeticks_ = base::TimeTicks();
- current_frame_time_ = base::Time();
}
-void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks,
- base::Time* now) const {
+void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks) const {
if (ticks->is_null()) {
- DCHECK(now->is_null());
*ticks = CurrentPhysicalTimeTicks();
- *now = base::Time::Now();
}
}
base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() {
- UpdateCurrentFrameTime(&current_frame_timeticks_, &current_frame_time_);
+ UpdateCurrentFrameTime(&current_frame_timeticks_);
return current_frame_timeticks_;
}
-base::Time LayerTreeHostImpl::CurrentFrameTime() {
- UpdateCurrentFrameTime(&current_frame_timeticks_, &current_frame_time_);
- return current_frame_time_;
-}
-
base::TimeTicks LayerTreeHostImpl::CurrentPhysicalTimeTicks() const {
return gfx::FrameTime::Now();
}

Powered by Google App Engine
This is Rietveld 408576698