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
parent 384daf4d
...@@ -52,8 +52,8 @@ BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor( ...@@ -52,8 +52,8 @@ BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor(
// produce output, the Renderer Impl thread the middle 1/3 of a frame to produce // 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 // ouput, and the Renderer Main thread the first 1/3 of a frame to produce
// output. // output.
base::TimeDelta BeginFrameArgs::DefaultDeadlineAdjustment() { base::TimeDelta BeginFrameArgs::DefaultEstimatedParentDrawTime() {
return base::TimeDelta::FromMicroseconds(-16666 / 3); return base::TimeDelta::FromMicroseconds(16666 / 3);
} }
base::TimeDelta BeginFrameArgs::DefaultInterval() { base::TimeDelta BeginFrameArgs::DefaultInterval() {
......
...@@ -25,7 +25,7 @@ struct CC_EXPORT BeginFrameArgs { ...@@ -25,7 +25,7 @@ struct CC_EXPORT BeginFrameArgs {
// This is the default delta that will be used to adjust the deadline when // This is the default delta that will be used to adjust the deadline when
// proper draw-time estimations are not yet available. // 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 // This is the default interval to use to avoid sprinkling the code with
// magic numbers. // magic numbers.
......
...@@ -137,6 +137,7 @@ void Scheduler::CommitVSyncParameters(base::TimeTicks timebase, ...@@ -137,6 +137,7 @@ void Scheduler::CommitVSyncParameters(base::TimeTicks timebase,
} }
void Scheduler::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { void Scheduler::SetEstimatedParentDrawTime(base::TimeDelta draw_time) {
DCHECK_GE(draw_time.ToInternalValue(), 0);
estimated_parent_draw_time_ = draw_time; estimated_parent_draw_time_ = draw_time;
} }
......
...@@ -2006,7 +2006,7 @@ bool LayerTreeHostImpl::InitializeRenderer( ...@@ -2006,7 +2006,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
// TODO(brianderson): Don't use a hard-coded parent draw time. // TODO(brianderson): Don't use a hard-coded parent draw time.
base::TimeDelta parent_draw_time = base::TimeDelta parent_draw_time =
output_surface_->capabilities().adjust_deadline_for_parent output_surface_->capabilities().adjust_deadline_for_parent
? BeginFrameArgs::DefaultDeadlineAdjustment() ? BeginFrameArgs::DefaultEstimatedParentDrawTime()
: base::TimeDelta(); : base::TimeDelta();
client_->SetEstimatedParentDrawTime(parent_draw_time); client_->SetEstimatedParentDrawTime(parent_draw_time);
......
...@@ -1305,13 +1305,14 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating ...@@ -1305,13 +1305,14 @@ class LayerTreeHostAnimationTestAddAnimationAfterAnimating
virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, virtual void SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
bool result) OVERRIDE { bool result) OVERRIDE {
// The third frame is when both animations have started. Check that both // After both animations have started, verify that they have valid
// have a valid start time. // start times.
if (++num_swap_buffers_ == 3) { num_swap_buffers_++;
AnimationRegistrar::AnimationControllerMap copy =
host_impl->animation_registrar()->active_animation_controllers();
if (copy.size() == 2u) {
EndTest(); EndTest();
AnimationRegistrar::AnimationControllerMap copy = EXPECT_GE(num_swap_buffers_, 3);
host_impl->animation_registrar()->active_animation_controllers();
EXPECT_EQ(2u, copy.size());
for (AnimationRegistrar::AnimationControllerMap::iterator iter = for (AnimationRegistrar::AnimationControllerMap::iterator iter =
copy.begin(); copy.begin();
iter != copy.end(); iter != copy.end();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment