| 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_state_machine.h" | 5 #include "cc/scheduler/scheduler_state_machine.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 // compositor. | 794 // compositor. |
| 795 if (!SupportsProactiveBeginFrame()) { | 795 if (!SupportsProactiveBeginFrame()) { |
| 796 return !BeginFrameNeededToDraw() && ProactiveBeginFrameWanted(); | 796 return !BeginFrameNeededToDraw() && ProactiveBeginFrameWanted(); |
| 797 } | 797 } |
| 798 | 798 |
| 799 // Non synchronous compositors should rely on | 799 // Non synchronous compositors should rely on |
| 800 // ProactiveBeginFrameWanted to poll for state instead. | 800 // ProactiveBeginFrameWanted to poll for state instead. |
| 801 return false; | 801 return false; |
| 802 } | 802 } |
| 803 | 803 |
| 804 // Note: If SupportsProactiveBeginFrame is false, the scheduler should poll |
| 805 // for changes in it's draw state so it can request a BeginFrame when it's |
| 806 // actually ready. |
| 804 bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { | 807 bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { |
| 805 // Both the synchronous compositor and disabled vsync settings | 808 // It is undesirable to proactively request BeginFrames if we are |
| 806 // make it undesirable to proactively request BeginImplFrames. | 809 // using a synchronous compositor because we *must* draw for every |
| 807 // If this is true, the scheduler should poll. | 810 // BeginFrame, which could cause duplicate draws. |
| 808 return !settings_.using_synchronous_renderer_compositor; | 811 return !settings_.using_synchronous_renderer_compositor; |
| 809 } | 812 } |
| 810 | 813 |
| 811 // These are the cases where we definitely (or almost definitely) have a | 814 // These are the cases where we definitely (or almost definitely) have a |
| 812 // new frame to draw and can draw. | 815 // new frame to draw and can draw. |
| 813 bool SchedulerStateMachine::BeginFrameNeededToDraw() const { | 816 bool SchedulerStateMachine::BeginFrameNeededToDraw() const { |
| 814 // The output surface is the provider of BeginImplFrames, so we are not going | 817 // The output surface is the provider of BeginImplFrames, so we are not going |
| 815 // to get them even if we ask for them. | 818 // to get them even if we ask for them. |
| 816 if (!HasInitializedOutputSurface()) | 819 if (!HasInitializedOutputSurface()) |
| 817 return false; | 820 return false; |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 case OUTPUT_SURFACE_ACTIVE: | 1187 case OUTPUT_SURFACE_ACTIVE: |
| 1185 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: | 1188 case OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT: |
| 1186 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: | 1189 case OUTPUT_SURFACE_WAITING_FOR_FIRST_ACTIVATION: |
| 1187 return true; | 1190 return true; |
| 1188 } | 1191 } |
| 1189 NOTREACHED(); | 1192 NOTREACHED(); |
| 1190 return false; | 1193 return false; |
| 1191 } | 1194 } |
| 1192 | 1195 |
| 1193 } // namespace cc | 1196 } // namespace cc |
| OLD | NEW |