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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 26880010: gfx: Add FrameTime and DisplayTime classes (Closed) Base URL: http://git.chromium.org/chromium/src.git@checkHighResNow4
Patch Set: WIP Created 7 years, 2 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
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12f2f01771bf0b3a63abe01b5a3577413a9eb7be..cc91004093c28d778332f8db5c148d1a2bed7f31 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -142,7 +142,7 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
}
layer_tree_host_impl_->Animate(
- layer_tree_host_impl_->CurrentFrameTimeTicks(),
+ gfx::FrameTime::Now(),
layer_tree_host_impl_->CurrentFrameTime());
layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true);
bool start_ready_animations = true;
@@ -350,7 +350,7 @@ bool LayerTreeHostImpl::CanDraw() const {
return true;
}
-void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time,
+void LayerTreeHostImpl::Animate(gfx::FrameTime monotonic_time,
base::Time wall_clock_time) {
if (input_handler_client_)
input_handler_client_->Animate(monotonic_time);
@@ -1248,7 +1248,7 @@ static void LayerTreeHostImplDidBeginTracingCallback(LayerImpl* layer) {
}
void LayerTreeHostImpl::DrawLayers(FrameData* frame,
- base::TimeTicks frame_begin_time) {
+ gfx::FrameTime frame_begin_time) {
TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers");
DCHECK(CanDraw());
@@ -2315,7 +2315,7 @@ void LayerTreeHostImpl::MouseMoveAt(gfx::Point viewport_point) {
scroll_layer_impl->scrollbar_animation_controller();
if (animation_controller) {
animation_controller->DidMouseMoveOffScrollbar(
- CurrentPhysicalTimeTicks());
+ CurrentPhysicalFrameTime());
StartScrollbarAnimation();
}
scroll_layer_id_when_mouse_over_scrollbar_ = 0;
@@ -2340,7 +2340,7 @@ void LayerTreeHostImpl::MouseMoveAt(gfx::Point viewport_point) {
scroll_layer_impl->vertical_scrollbar_layer()));
bool should_animate = animation_controller->DidMouseMoveNear(
- CurrentPhysicalTimeTicks(), distance_to_scrollbar / device_scale_factor_);
+ CurrentPhysicalFrameTime(), distance_to_scrollbar / device_scale_factor_);
if (should_animate) {
client_->SetNeedsRedrawOnImplThread();
StartScrollbarAnimation();
@@ -2355,7 +2355,7 @@ bool LayerTreeHostImpl::HandleMouseOverScrollbar(LayerImpl* layer_impl,
if (layer_impl && layer_impl->scrollbar_animation_controller()) {
scroll_layer_id_when_mouse_over_scrollbar_ = scroll_layer_id;
layer_impl->scrollbar_animation_controller()->DidMouseMoveNear(
- CurrentPhysicalTimeTicks(), 0);
+ CurrentPhysicalFrameTime(), 0);
} else {
scroll_layer_id_when_mouse_over_scrollbar_ = 0;
}
@@ -2445,11 +2445,11 @@ void LayerTreeHostImpl::SetFullRootLayerDamage() {
SetViewportDamage(gfx::Rect(DrawViewportSize()));
}
-void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks time) {
+void LayerTreeHostImpl::AnimatePageScale(gfx::FrameTime time) {
if (!page_scale_animation_ || !RootScrollLayer())
return;
- double monotonic_time = (time - base::TimeTicks()).InSecondsF();
+ double monotonic_time = time.Unsafe_InSecondsF();
gfx::Vector2dF scroll_total = RootScrollLayer()->scroll_offset() +
RootScrollLayer()->ScrollDelta();
@@ -2472,7 +2472,7 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks time) {
}
}
-void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
+void LayerTreeHostImpl::AnimateTopControls(gfx::FrameTime time) {
if (!top_controls_manager_ || !RootScrollLayer())
return;
gfx::Vector2dF scroll = top_controls_manager_->Animate(time);
@@ -2483,7 +2483,7 @@ void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
scroll, 1.f / active_tree_->total_page_scale_factor()));
}
-void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time,
+void LayerTreeHostImpl::AnimateLayers(gfx::FrameTime monotonic_time,
base::Time wall_clock_time) {
if (!settings_.accelerated_animation_enabled ||
animation_registrar_->active_animation_controllers().empty() ||
@@ -2493,7 +2493,7 @@ 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();
+ double monotonic_seconds = monotonic_time.Unsafe_InSecondsF();
AnimationRegistrar::AnimationControllerMap copy =
animation_registrar_->active_animation_controllers();
@@ -2601,12 +2601,12 @@ void LayerTreeHostImpl::SendManagedMemoryStats(
last_sent_memory_use_bytes_);
}
-void LayerTreeHostImpl::AnimateScrollbars(base::TimeTicks time) {
+void LayerTreeHostImpl::AnimateScrollbars(gfx::FrameTime time) {
AnimateScrollbarsRecursive(active_tree_->root_layer(), time);
}
void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
- base::TimeTicks time) {
+ gfx::FrameTime time) {
if (!layer)
return;
@@ -2625,11 +2625,11 @@ void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
void LayerTreeHostImpl::StartScrollbarAnimation() {
TRACE_EVENT0("cc", "LayerTreeHostImpl::StartScrollbarAnimation");
- StartScrollbarAnimationRecursive(RootLayer(), CurrentPhysicalTimeTicks());
+ StartScrollbarAnimationRecursive(RootLayer(), CurrentFrameTimeTicks());
}
void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer,
- base::TimeTicks time) {
+ gfx::FrameTime time) {
if (!layer)
return;
@@ -2658,20 +2658,20 @@ void LayerTreeHostImpl::SetTreePriority(TreePriority priority) {
}
void LayerTreeHostImpl::ResetCurrentFrameTimeForNextFrame() {
- current_frame_timeticks_ = base::TimeTicks();
+ current_frame_timeticks_ = gfx::FrameTime();
current_frame_time_ = base::Time();
}
-void LayerTreeHostImpl::UpdateCurrentFrameTime(base::TimeTicks* ticks,
+void LayerTreeHostImpl::UpdateCurrentFrameTime(gfx::FrameTime* ticks,
base::Time* now) const {
if (ticks->is_null()) {
DCHECK(now->is_null());
- *ticks = CurrentPhysicalTimeTicks();
+ *ticks = gfx::FrameTime::Now();
*now = base::Time::Now();
}
}
-base::TimeTicks LayerTreeHostImpl::CurrentFrameTimeTicks() {
+gfx::FrameTime LayerTreeHostImpl::CurrentFrameTimeTicks() {
UpdateCurrentFrameTime(&current_frame_timeticks_, &current_frame_time_);
return current_frame_timeticks_;
}
@@ -2681,7 +2681,7 @@ base::Time LayerTreeHostImpl::CurrentFrameTime() {
return current_frame_time_;
}
-base::TimeTicks LayerTreeHostImpl::CurrentPhysicalTimeTicks() const {
+gfx::FrameTime LayerTreeHostImpl::CurrentPhysicalFrameTime() const {
return gfx::FrameTime::Now();
}
« 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