Chromium Code Reviews| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 } | 126 } |
| 127 | 127 |
| 128 void Scheduler::SetupNextBeginFrameIfNeeded() { | 128 void Scheduler::SetupNextBeginFrameIfNeeded() { |
| 129 bool needs_begin_frame_to_draw = | 129 bool needs_begin_frame_to_draw = |
| 130 state_machine_.BeginFrameNeededToDrawByImplThread(); | 130 state_machine_.BeginFrameNeededToDrawByImplThread(); |
| 131 // We want to avoid proactive begin frames with the synchronous compositor | 131 // We want to avoid proactive begin frames with the synchronous compositor |
| 132 // because every SetNeedsBeginFrame will force a redraw. | 132 // because every SetNeedsBeginFrame will force a redraw. |
| 133 bool proactive_begin_frame_wanted = | 133 bool proactive_begin_frame_wanted = |
| 134 state_machine_.ProactiveBeginFrameWantedByImplThread() && | 134 state_machine_.ProactiveBeginFrameWantedByImplThread() && |
| 135 !settings_.using_synchronous_renderer_compositor; | 135 !settings_.using_synchronous_renderer_compositor; |
| 136 bool needs_begin_frame = needs_begin_frame_to_draw || | 136 bool needs_begin_frame = state_machine_.inside_begin_frame() ? |
| 137 needs_begin_frame_to_draw : | |
| 138 needs_begin_frame_to_draw || | |
|
dshwang
2013/06/24 18:53:20
"state_machine_.inside_begin_frame() is true" mean
| |
| 137 proactive_begin_frame_wanted; | 139 proactive_begin_frame_wanted; |
| 138 bool immediate_disables_needed = | 140 bool immediate_disables_needed = |
| 139 settings_.using_synchronous_renderer_compositor; | 141 settings_.using_synchronous_renderer_compositor; |
| 140 | 142 |
| 141 if (needs_begin_frame_to_draw) | 143 if (needs_begin_frame_to_draw) |
| 142 safe_to_expect_begin_frame_ = true; | 144 safe_to_expect_begin_frame_ = true; |
| 143 | 145 |
| 144 // Determine if we need BeginFrame notifications. | 146 // Determine if we need BeginFrame notifications. |
| 145 // If we do, always request the BeginFrame immediately. | 147 // If we do, always request the BeginFrame immediately. |
| 146 // If not, only disable on the next BeginFrame to avoid unnecessary toggles. | 148 // If not, only disable on the next BeginFrame to avoid unnecessary toggles. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 | 236 |
| 235 SetupNextBeginFrameIfNeeded(); | 237 SetupNextBeginFrameIfNeeded(); |
| 236 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); | 238 client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime()); |
| 237 } | 239 } |
| 238 | 240 |
| 239 bool Scheduler::WillDrawIfNeeded() const { | 241 bool Scheduler::WillDrawIfNeeded() const { |
| 240 return !state_machine_.DrawSuspendedUntilCommit(); | 242 return !state_machine_.DrawSuspendedUntilCommit(); |
| 241 } | 243 } |
| 242 | 244 |
| 243 } // namespace cc | 245 } // namespace cc |
| OLD | NEW |