| 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" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 state_machine_.OnBeginFrame(last_begin_frame_args_); | 177 state_machine_.OnBeginFrame(last_begin_frame_args_); |
| 178 ProcessScheduledActions(); | 178 ProcessScheduledActions(); |
| 179 | 179 |
| 180 if (state_machine_.ShouldTriggerBeginFrameDeadlineEarly()) | 180 if (state_machine_.ShouldTriggerBeginFrameDeadlineEarly()) |
| 181 PostBeginFrameDeadline(base::TimeTicks()); | 181 PostBeginFrameDeadline(base::TimeTicks()); |
| 182 else | 182 else |
| 183 PostBeginFrameDeadline(last_begin_frame_args_.deadline); | 183 PostBeginFrameDeadline(last_begin_frame_args_.deadline); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void Scheduler::PostBeginFrameDeadline(base::TimeTicks deadline) { | 186 void Scheduler::PostBeginFrameDeadline(base::TimeTicks deadline) { |
| 187 if (settings_.using_synchronous_renderer_compositor) { |
| 188 OnBeginFrameDeadline(); |
| 189 return; |
| 190 } |
| 191 |
| 187 begin_frame_deadline_closure_.Cancel(); | 192 begin_frame_deadline_closure_.Cancel(); |
| 188 begin_frame_deadline_closure_.Reset( | 193 begin_frame_deadline_closure_.Reset( |
| 189 base::Bind(&Scheduler::OnBeginFrameDeadline, weak_factory_.GetWeakPtr())); | 194 base::Bind(&Scheduler::OnBeginFrameDeadline, weak_factory_.GetWeakPtr())); |
| 190 client_->PostBeginFrameDeadline( | 195 client_->PostBeginFrameDeadline( |
| 191 begin_frame_deadline_closure_.callback(), deadline); | 196 begin_frame_deadline_closure_.callback(), deadline); |
| 192 } | 197 } |
| 193 | 198 |
| 194 void Scheduler::OnBeginFrameDeadline() { | 199 void Scheduler::OnBeginFrameDeadline() { |
| 195 TRACE_EVENT0("cc", "Scheduler::OnBeginFrameDeadline"); | 200 TRACE_EVENT0("cc", "Scheduler::OnBeginFrameDeadline"); |
| 196 begin_frame_deadline_closure_.Cancel(); | 201 begin_frame_deadline_closure_.Cancel(); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 265 |
| 261 SetupNextBeginFrameIfNeeded(); | 266 SetupNextBeginFrameIfNeeded(); |
| 262 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 267 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
| 263 } | 268 } |
| 264 | 269 |
| 265 bool Scheduler::WillDrawIfNeeded() const { | 270 bool Scheduler::WillDrawIfNeeded() const { |
| 266 return !state_machine_.DrawSuspendedUntilCommit(); | 271 return !state_machine_.DrawSuspendedUntilCommit(); |
| 267 } | 272 } |
| 268 | 273 |
| 269 } // namespace cc | 274 } // namespace cc |
| OLD | NEW |