| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ProcessScheduledActions(); | 42 ProcessScheduledActions(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void Scheduler::NotifyReadyToActivate() { | 45 void Scheduler::NotifyReadyToActivate() { |
| 46 state_machine_.NotifyReadyToActivate(); | 46 state_machine_.NotifyReadyToActivate(); |
| 47 ProcessScheduledActions(); | 47 ProcessScheduledActions(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Scheduler::ActivatePendingTree() { | 50 void Scheduler::ActivatePendingTree() { |
| 51 client_->ScheduledActionActivatePendingTree(); | 51 client_->ScheduledActionActivatePendingTree(); |
| 52 if (state_machine_.ShouldTriggerBeginFrameDeadlineEarly()) | |
| 53 PostBeginFrameDeadline(base::TimeTicks()); | |
| 54 } | 52 } |
| 55 | 53 |
| 56 void Scheduler::SetNeedsCommit() { | 54 void Scheduler::SetNeedsCommit() { |
| 57 state_machine_.SetNeedsCommit(); | 55 state_machine_.SetNeedsCommit(); |
| 58 ProcessScheduledActions(); | 56 ProcessScheduledActions(); |
| 59 } | 57 } |
| 60 | 58 |
| 61 void Scheduler::SetNeedsForcedCommitForReadback() { | 59 void Scheduler::SetNeedsForcedCommitForReadback() { |
| 62 state_machine_.SetNeedsCommit(); | 60 state_machine_.SetNeedsCommit(); |
| 63 state_machine_.SetNeedsForcedCommitForReadback(); | 61 state_machine_.SetNeedsForcedCommitForReadback(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 82 | 80 |
| 83 void Scheduler::SetMainThreadNeedsLayerTextures() { | 81 void Scheduler::SetMainThreadNeedsLayerTextures() { |
| 84 state_machine_.SetMainThreadNeedsLayerTextures(); | 82 state_machine_.SetMainThreadNeedsLayerTextures(); |
| 85 ProcessScheduledActions(); | 83 ProcessScheduledActions(); |
| 86 } | 84 } |
| 87 | 85 |
| 88 void Scheduler::FinishCommit() { | 86 void Scheduler::FinishCommit() { |
| 89 TRACE_EVENT0("cc", "Scheduler::FinishCommit"); | 87 TRACE_EVENT0("cc", "Scheduler::FinishCommit"); |
| 90 state_machine_.FinishCommit(); | 88 state_machine_.FinishCommit(); |
| 91 ProcessScheduledActions(); | 89 ProcessScheduledActions(); |
| 92 | |
| 93 if (state_machine_.ShouldTriggerBeginFrameDeadlineEarly()) | |
| 94 PostBeginFrameDeadline(base::TimeTicks()); | |
| 95 } | 90 } |
| 96 | 91 |
| 97 void Scheduler::BeginFrameAbortedByMainThread(bool did_handle) { | 92 void Scheduler::BeginFrameAbortedByMainThread(bool did_handle) { |
| 98 TRACE_EVENT0("cc", "Scheduler::BeginFrameAbortedByMainThread"); | 93 TRACE_EVENT0("cc", "Scheduler::BeginFrameAbortedByMainThread"); |
| 99 state_machine_.BeginFrameAbortedByMainThread(did_handle); | 94 state_machine_.BeginFrameAbortedByMainThread(did_handle); |
| 100 ProcessScheduledActions(); | 95 ProcessScheduledActions(); |
| 101 } | 96 } |
| 102 | 97 |
| 103 void Scheduler::DidLoseOutputSurface() { | 98 void Scheduler::DidLoseOutputSurface() { |
| 104 TRACE_EVENT0("cc", "Scheduler::DidLoseOutputSurface"); | 99 TRACE_EVENT0("cc", "Scheduler::DidLoseOutputSurface"); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 client_->ScheduledActionAcquireLayerTexturesForMainThread(); | 318 client_->ScheduledActionAcquireLayerTexturesForMainThread(); |
| 324 break; | 319 break; |
| 325 case SchedulerStateMachine::ACTION_MANAGE_TILES: | 320 case SchedulerStateMachine::ACTION_MANAGE_TILES: |
| 326 client_->ScheduledActionManageTiles(); | 321 client_->ScheduledActionManageTiles(); |
| 327 break; | 322 break; |
| 328 } | 323 } |
| 329 } while (action != SchedulerStateMachine::ACTION_NONE); | 324 } while (action != SchedulerStateMachine::ACTION_NONE); |
| 330 | 325 |
| 331 SetupNextBeginFrameIfNeeded(); | 326 SetupNextBeginFrameIfNeeded(); |
| 332 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 327 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
| 328 |
| 329 if (state_machine_.ShouldTriggerBeginFrameDeadlineEarly()) |
| 330 PostBeginFrameDeadline(base::TimeTicks()); |
| 333 } | 331 } |
| 334 | 332 |
| 335 bool Scheduler::WillDrawIfNeeded() const { | 333 bool Scheduler::WillDrawIfNeeded() const { |
| 336 return !state_machine_.PendingDrawsShouldBeAborted(); | 334 return !state_machine_.PendingDrawsShouldBeAborted(); |
| 337 } | 335 } |
| 338 | 336 |
| 339 } // namespace cc | 337 } // namespace cc |
| OLD | NEW |