| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/scheduler/scheduler.h" | 5 #include "cc/scheduler/scheduler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "cc/debug/traced_value.h" | 11 #include "cc/debug/traced_value.h" |
| 12 #include "ui/gfx/frame_time.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 Scheduler::Scheduler(SchedulerClient* client, | 16 Scheduler::Scheduler(SchedulerClient* client, |
| 16 const SchedulerSettings& scheduler_settings) | 17 const SchedulerSettings& scheduler_settings) |
| 17 : settings_(scheduler_settings), | 18 : settings_(scheduler_settings), |
| 18 client_(client), | 19 client_(client), |
| 19 last_set_needs_begin_impl_frame_(false), | 20 last_set_needs_begin_impl_frame_(false), |
| 20 state_machine_(scheduler_settings), | 21 state_machine_(scheduler_settings), |
| 21 inside_process_scheduled_actions_(false), | 22 inside_process_scheduled_actions_(false), |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 ProcessScheduledActions(); | 117 ProcessScheduledActions(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 base::TimeTicks Scheduler::AnticipatedDrawTime() { | 120 base::TimeTicks Scheduler::AnticipatedDrawTime() { |
| 120 TRACE_EVENT0("cc", "Scheduler::AnticipatedDrawTime"); | 121 TRACE_EVENT0("cc", "Scheduler::AnticipatedDrawTime"); |
| 121 | 122 |
| 122 if (!last_set_needs_begin_impl_frame_ || | 123 if (!last_set_needs_begin_impl_frame_ || |
| 123 last_begin_impl_frame_args_.interval <= base::TimeDelta()) | 124 last_begin_impl_frame_args_.interval <= base::TimeDelta()) |
| 124 return base::TimeTicks(); | 125 return base::TimeTicks(); |
| 125 | 126 |
| 126 base::TimeTicks now = base::TimeTicks::Now(); | 127 base::TimeTicks now = gfx::FrameTime::Now(); |
| 127 base::TimeTicks timebase = std::max(last_begin_impl_frame_args_.frame_time, | 128 base::TimeTicks timebase = std::max(last_begin_impl_frame_args_.frame_time, |
| 128 last_begin_impl_frame_args_.deadline); | 129 last_begin_impl_frame_args_.deadline); |
| 129 int64 intervals = | 130 int64 intervals = |
| 130 1 + ((now - timebase) / last_begin_impl_frame_args_.interval); | 131 1 + ((now - timebase) / last_begin_impl_frame_args_.interval); |
| 131 return timebase + (last_begin_impl_frame_args_.interval * intervals); | 132 return timebase + (last_begin_impl_frame_args_.interval * intervals); |
| 132 } | 133 } |
| 133 | 134 |
| 134 base::TimeTicks Scheduler::LastBeginImplFrameTime() { | 135 base::TimeTicks Scheduler::LastBeginImplFrameTime() { |
| 135 return last_begin_impl_frame_args_.frame_time; | 136 return last_begin_impl_frame_args_.frame_time; |
| 136 } | 137 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 338 |
| 338 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) | 339 if (state_machine_.ShouldTriggerBeginImplFrameDeadlineEarly()) |
| 339 PostBeginImplFrameDeadline(base::TimeTicks()); | 340 PostBeginImplFrameDeadline(base::TimeTicks()); |
| 340 } | 341 } |
| 341 | 342 |
| 342 bool Scheduler::WillDrawIfNeeded() const { | 343 bool Scheduler::WillDrawIfNeeded() const { |
| 343 return !state_machine_.PendingDrawsShouldBeAborted(); | 344 return !state_machine_.PendingDrawsShouldBeAborted(); |
| 344 } | 345 } |
| 345 | 346 |
| 346 } // namespace cc | 347 } // namespace cc |
| OLD | NEW |