| 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/scheduler/delay_based_time_source.h" | 17 #include "cc/scheduler/delay_based_time_source.h" |
| 18 #include "cc/scheduler/draw_result.h" | 18 #include "cc/scheduler/draw_result.h" |
| 19 #include "cc/scheduler/scheduler_settings.h" | 19 #include "cc/scheduler/scheduler_settings.h" |
| 20 #include "cc/scheduler/scheduler_state_machine.h" | 20 #include "cc/scheduler/scheduler_state_machine.h" |
| 21 #include "ui/gfx/frame_time.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| 23 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace cc { | 27 namespace cc { |
| 27 | 28 |
| 28 class SchedulerClient { | 29 class SchedulerClient { |
| 29 public: | 30 public: |
| 30 virtual void SetNeedsBeginFrame(bool enable) = 0; | 31 virtual void SetNeedsBeginFrame(bool enable) = 0; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 Scheduler* scheduler_; | 170 Scheduler* scheduler_; |
| 170 scoped_refptr<DelayBasedTimeSource> time_source_; | 171 scoped_refptr<DelayBasedTimeSource> time_source_; |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 Scheduler( | 174 Scheduler( |
| 174 SchedulerClient* client, | 175 SchedulerClient* client, |
| 175 const SchedulerSettings& scheduler_settings, | 176 const SchedulerSettings& scheduler_settings, |
| 176 int layer_tree_host_id, | 177 int layer_tree_host_id, |
| 177 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner); | 178 const scoped_refptr<base::SingleThreadTaskRunner>& impl_task_runner); |
| 178 | 179 |
| 180 virtual base::TimeTicks Now() const; |
| 181 virtual void SetupSyntheticBeginFrames(); |
| 182 |
| 179 const SchedulerSettings settings_; | 183 const SchedulerSettings settings_; |
| 180 SchedulerClient* client_; | 184 SchedulerClient* client_; |
| 181 int layer_tree_host_id_; | 185 int layer_tree_host_id_; |
| 182 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; | 186 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner_; |
| 183 | 187 |
| 184 base::TimeDelta vsync_interval_; | 188 base::TimeDelta vsync_interval_; |
| 185 base::TimeDelta estimated_parent_draw_time_; | 189 base::TimeDelta estimated_parent_draw_time_; |
| 186 | 190 |
| 187 bool last_set_needs_begin_frame_; | 191 bool last_set_needs_begin_frame_; |
| 188 bool begin_unthrottled_frame_posted_; | 192 bool begin_unthrottled_frame_posted_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 214 void SetupNextBeginFrameIfNeeded(); | 218 void SetupNextBeginFrameIfNeeded(); |
| 215 void PostBeginRetroFrameIfNeeded(); | 219 void PostBeginRetroFrameIfNeeded(); |
| 216 void SetupNextBeginFrameWhenVSyncThrottlingEnabled(bool needs_begin_frame); | 220 void SetupNextBeginFrameWhenVSyncThrottlingEnabled(bool needs_begin_frame); |
| 217 void SetupNextBeginFrameWhenVSyncThrottlingDisabled(bool needs_begin_frame); | 221 void SetupNextBeginFrameWhenVSyncThrottlingDisabled(bool needs_begin_frame); |
| 218 void SetupPollingMechanisms(bool needs_begin_frame); | 222 void SetupPollingMechanisms(bool needs_begin_frame); |
| 219 void DrawAndSwapIfPossible(); | 223 void DrawAndSwapIfPossible(); |
| 220 void ProcessScheduledActions(); | 224 void ProcessScheduledActions(); |
| 221 bool CanCommitAndActivateBeforeDeadline() const; | 225 bool CanCommitAndActivateBeforeDeadline() const; |
| 222 void AdvanceCommitStateIfPossible(); | 226 void AdvanceCommitStateIfPossible(); |
| 223 bool IsBeginMainFrameSentOrStarted() const; | 227 bool IsBeginMainFrameSentOrStarted() const; |
| 224 void SetupSyntheticBeginFrames(); | |
| 225 | 228 |
| 226 base::WeakPtrFactory<Scheduler> weak_factory_; | 229 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 227 | 230 |
| 228 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 231 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 229 }; | 232 }; |
| 230 | 233 |
| 231 } // namespace cc | 234 } // namespace cc |
| 232 | 235 |
| 233 #endif // CC_SCHEDULER_SCHEDULER_H_ | 236 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |