| 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 #ifndef CC_SCHEDULER_SCHEDULER_H_ | 5 #ifndef CC_SCHEDULER_SCHEDULER_H_ |
| 6 #define CC_SCHEDULER_SCHEDULER_H_ | 6 #define CC_SCHEDULER_SCHEDULER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
| 16 #include "cc/output/begin_frame_args.h" | 16 #include "cc/output/begin_frame_args.h" |
| 17 #include "cc/output/output_surface.h" |
| 17 #include "cc/scheduler/delay_based_time_source.h" | 18 #include "cc/scheduler/delay_based_time_source.h" |
| 18 #include "cc/scheduler/draw_result.h" | 19 #include "cc/scheduler/draw_result.h" |
| 19 #include "cc/scheduler/frame_source.h" | 20 #include "cc/scheduler/frame_source.h" |
| 20 #include "cc/scheduler/scheduler_settings.h" | 21 #include "cc/scheduler/scheduler_settings.h" |
| 21 #include "cc/scheduler/scheduler_state_machine.h" | 22 #include "cc/scheduler/scheduler_state_machine.h" |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 namespace debug { | 25 namespace debug { |
| 25 class ConvertableToTraceFormat; | 26 class ConvertableToTraceFormat; |
| 26 } | 27 } |
| 27 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace cc { | 31 namespace cc { |
| 31 | 32 |
| 32 class SchedulerClient { | 33 class SchedulerClient { |
| 33 public: | 34 public: |
| 34 virtual BeginFrameSource* GetExternalBeginFrameSource() = 0; | |
| 35 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; | 35 virtual void WillBeginImplFrame(const BeginFrameArgs& args) = 0; |
| 36 virtual void ScheduledActionSendBeginMainFrame() = 0; | 36 virtual void ScheduledActionSendBeginMainFrame() = 0; |
| 37 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; | 37 virtual DrawResult ScheduledActionDrawAndSwapIfPossible() = 0; |
| 38 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; | 38 virtual DrawResult ScheduledActionDrawAndSwapForced() = 0; |
| 39 virtual void ScheduledActionAnimate() = 0; | 39 virtual void ScheduledActionAnimate() = 0; |
| 40 virtual void ScheduledActionCommit() = 0; | 40 virtual void ScheduledActionCommit() = 0; |
| 41 virtual void ScheduledActionUpdateVisibleTiles() = 0; | 41 virtual void ScheduledActionUpdateVisibleTiles() = 0; |
| 42 virtual void ScheduledActionActivateSyncTree() = 0; | 42 virtual void ScheduledActionActivateSyncTree() = 0; |
| 43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; | 43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; |
| 44 virtual void ScheduledActionManageTiles() = 0; | 44 virtual void ScheduledActionManageTiles() = 0; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); | 92 void SetSwapUsedIncompleteTile(bool used_incomplete_tile); |
| 93 void DidSwapBuffersComplete(); | 93 void DidSwapBuffersComplete(); |
| 94 | 94 |
| 95 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); | 95 void SetImplLatencyTakesPriority(bool impl_latency_takes_priority); |
| 96 | 96 |
| 97 void NotifyReadyToCommit(); | 97 void NotifyReadyToCommit(); |
| 98 void BeginMainFrameAborted(bool did_handle); | 98 void BeginMainFrameAborted(bool did_handle); |
| 99 | 99 |
| 100 void DidManageTiles(); | 100 void DidManageTiles(); |
| 101 void DidLoseOutputSurface(); | 101 void DidLoseOutputSurface(); |
| 102 void DidCreateAndInitializeOutputSurface(); | 102 void DidCreateAndInitializeOutputSurface(OutputSurface* output_surface); |
| 103 | 103 |
| 104 // Tests do not want to shut down until all possible BeginMainFrames have | 104 // Tests do not want to shut down until all possible BeginMainFrames have |
| 105 // occured to prevent flakiness. | 105 // occured to prevent flakiness. |
| 106 bool MainFrameForTestingWillHappen() const { | 106 bool MainFrameForTestingWillHappen() const { |
| 107 return state_machine_.CommitPending() || | 107 return state_machine_.CommitPending() || |
| 108 state_machine_.CouldSendBeginMainFrame(); | 108 state_machine_.CouldSendBeginMainFrame(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool CommitPending() const { return state_machine_.CommitPending(); } | 111 bool CommitPending() const { return state_machine_.CommitPending(); } |
| 112 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 112 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 132 void SetContinuousPainting(bool continuous_painting) { | 132 void SetContinuousPainting(bool continuous_painting) { |
| 133 state_machine_.SetContinuousPainting(continuous_painting); | 133 state_machine_.SetContinuousPainting(continuous_painting); |
| 134 } | 134 } |
| 135 | 135 |
| 136 // BeginFrameObserver | 136 // BeginFrameObserver |
| 137 virtual void OnBeginFrame(const BeginFrameArgs& args) OVERRIDE; | 137 virtual void OnBeginFrame(const BeginFrameArgs& args) OVERRIDE; |
| 138 virtual const BeginFrameArgs& LastBeginFrameArgs() const OVERRIDE; | 138 virtual const BeginFrameArgs& LastBeginFrameArgs() const OVERRIDE; |
| 139 base::TimeTicks LastBeginImplFrameTime(); | 139 base::TimeTicks LastBeginImplFrameTime(); |
| 140 | 140 |
| 141 ui::CompositorVSyncManager::Observer* vsync_observer_ = NULL; | 141 ui::CompositorVSyncManager::Observer* vsync_observer_ = NULL; |
| 142 |
| 143 void UpdateActiveFrameSource(); |
| 144 |
| 142 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; | 145 scoped_ptr<BeginFrameSourceMultiplexer> frame_source_; |
| 143 BeginFrameSource* primary_frame_source_ = NULL; | 146 BeginFrameSource* primary_frame_source_ = NULL; |
| 144 BeginFrameSource* background_frame_source_ = NULL; | 147 BeginFrameSource* background_frame_source_ = NULL; |
| 145 | 148 |
| 146 // Storage for when using internal frame sources. | 149 // Storage for when using internal frame sources. |
| 147 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; | 150 scoped_ptr<BeginFrameSource> primary_frame_source_internal_; |
| 148 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; | 151 scoped_ptr<SyntheticBeginFrameSource> background_frame_source_internal_; |
| 149 | 152 |
| 150 protected: | 153 protected: |
| 151 Scheduler(SchedulerClient* client, | 154 Scheduler(SchedulerClient* client, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 } | 218 } |
| 216 | 219 |
| 217 base::WeakPtrFactory<Scheduler> weak_factory_; | 220 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 218 | 221 |
| 219 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 222 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 220 }; | 223 }; |
| 221 | 224 |
| 222 } // namespace cc | 225 } // namespace cc |
| 223 | 226 |
| 224 #endif // CC_SCHEDULER_SCHEDULER_H_ | 227 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |