diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 12:48:23 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-11 12:48:23 +0000 |
commit | 1d142de8f8fa739199f6f19c94b2c6a01e12603a (patch) | |
tree | 754cf5c3f42902c3f7daa6886fe10bc71de2d0bc /cc | |
parent | 384daf4d199e8ee29356a2aa61e6915caf5a7100 (diff) | |
download | chromium_src-1d142de8f8fa739199f6f19c94b2c6a01e12603a.zip chromium_src-1d142de8f8fa739199f6f19c94b2c6a01e12603a.tar.gz chromium_src-1d142de8f8fa739199f6f19c94b2c6a01e12603a.tar.bz2 |
cc: Fix negative EstimatedParentDrawTimes
BUG=380987
Review URL: https://codereview.chromium.org/311263016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/output/begin_frame_args.cc | 4 | ||||
-rw-r--r-- | cc/output/begin_frame_args.h | 2 | ||||
-rw-r--r-- | cc/scheduler/scheduler.cc | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest_animation.cc | 13 |
5 files changed, 12 insertions, 10 deletions
diff --git a/cc/output/begin_frame_args.cc b/cc/output/begin_frame_args.cc index a592ecc..065cadd 100644 --- a/cc/output/begin_frame_args.cc +++ b/cc/output/begin_frame_args.cc @@ -52,8 +52,8 @@ BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor( // produce output, the Renderer Impl thread the middle 1/3 of a frame to produce // ouput, and the Renderer Main thread the first 1/3 of a frame to produce // output. -base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() { - return base::TimeDelta::FromMicroseconds(-16666 / 3); +base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() { + return base::TimeDelta::FromMicroseconds(16666 / 3); } base::TimeDelta BeginFrameArgs::DefaultInterval() { diff --git a/cc/output/begin_frame_args.h b/cc/output/begin_frame_args.h index 6312e21..91ad182 100644 --- a/cc/output/begin_frame_args.h +++ b/cc/output/begin_frame_args.h @@ -25,7 +25,7 @@ struct CC_EXPORT BeginFrameArgs { // This is the default delta that will be used to adjust the deadline when // proper draw-time estimations are not yet available. - static base::TimeDelta DefaultDeadlineAdjustment(); + static base::TimeDelta DefaultEstimatedParentDrawTime(); // This is the default interval to use to avoid sprinkling the code with // magic numbers. diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index cc6ae1a..4130c64 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc @@ -137,6 +137,7 @@ void Scheduler::CommitVSyncParameters(base::TimeTicks timebase, } void Scheduler::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { + DCHECK_GE(draw_time.ToInternalValue(), 0); estimated_parent_draw_time_ = draw_time; } diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 7f6ae44..94d2864 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -2006,7 +2006,7 @@ bool LayerTreeHostImpl::InitializeRenderer( // TODO(brianderson): Don't use a hard-coded parent draw time. base::TimeDelta parent_draw_time = output_surface_->capabilities().adjust_deadline_for_parent - ? BeginFrameArgs::DefaultDeadlineAdjustment() + ? BeginFrameArgs::DefaultEstimatedParentDrawTime() : base::TimeDelta(); client_->SetEstimatedParentDrawTime(parent_draw_time); diff --git a/cc/trees/layer_tree_host_unittest_animation.cc b/cc/trees/layer_tree_host_unittest_animation.cc index 6aaf7ca..1542a14 100644 --- a/cc/trees/layer_tree_host_unittest_animation.cc +++ b/cc/trees/layer_tree_host_unittest_animation.cc @@ -1305,13 +1305,14 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) OVERRIDE { - // The third frame is when both animations have started. Check that both - // have a valid start time. - if (++num_swap_buffers_ == 3) { + // After both animations have started, verify that they have valid + // start times. + num_swap_buffers_++; + AnimationRegistrar::AnimationControllerMap copy = + host_impl->animation_registrar()->active_animation_controllers(); + if (copy.size() == 2u) { EndTest(); - AnimationRegistrar::AnimationControllerMap copy = - host_impl->animation_registrar()->active_animation_controllers(); - EXPECT_EQ(2u, copy.size()); + EXPECT_GE(num_swap_buffers_, 3); for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(); |