| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/output/begin_frame_args.h" |
| 14 #include "cc/scheduler/scheduler_settings.h" | 15 #include "cc/scheduler/scheduler_settings.h" |
| 15 #include "cc/scheduler/scheduler_state_machine.h" | 16 #include "cc/scheduler/scheduler_state_machine.h" |
| 16 #include "cc/trees/layer_tree_host.h" | 17 #include "cc/trees/layer_tree_host.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class Thread; | 21 class Thread; |
| 21 | 22 |
| 22 struct ScheduledActionDrawAndSwapResult { | 23 struct ScheduledActionDrawAndSwapResult { |
| 23 ScheduledActionDrawAndSwapResult() | 24 ScheduledActionDrawAndSwapResult() |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 94 |
| 94 bool CommitPending() const { return state_machine_.CommitPending(); } | 95 bool CommitPending() const { return state_machine_.CommitPending(); } |
| 95 bool RedrawPending() const { return state_machine_.RedrawPending(); } | 96 bool RedrawPending() const { return state_machine_.RedrawPending(); } |
| 96 | 97 |
| 97 bool WillDrawIfNeeded() const; | 98 bool WillDrawIfNeeded() const; |
| 98 | 99 |
| 99 base::TimeTicks AnticipatedDrawTime(); | 100 base::TimeTicks AnticipatedDrawTime(); |
| 100 | 101 |
| 101 base::TimeTicks LastBeginFrameOnImplThreadTime(); | 102 base::TimeTicks LastBeginFrameOnImplThreadTime(); |
| 102 | 103 |
| 103 void BeginFrame(base::TimeTicks frame_time); | 104 void BeginFrame(const BeginFrameArgs& args); |
| 104 | 105 |
| 105 std::string StateAsStringForTesting() { return state_machine_.ToString(); } | 106 std::string StateAsStringForTesting() { return state_machine_.ToString(); } |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 Scheduler(SchedulerClient* client, | 109 Scheduler(SchedulerClient* client, |
| 109 const SchedulerSettings& scheduler_settings); | 110 const SchedulerSettings& scheduler_settings); |
| 110 | 111 |
| 111 void SetupNextBeginFrameIfNeeded(); | 112 void SetupNextBeginFrameIfNeeded(); |
| 112 void DrawAndSwapIfPossible(); | 113 void DrawAndSwapIfPossible(); |
| 113 void DrawAndSwapForced(); | 114 void DrawAndSwapForced(); |
| 114 void ProcessScheduledActions(); | 115 void ProcessScheduledActions(); |
| 115 | 116 |
| 116 const SchedulerSettings settings_; | 117 const SchedulerSettings settings_; |
| 117 SchedulerClient* client_; | 118 SchedulerClient* client_; |
| 118 | 119 |
| 119 base::WeakPtrFactory<Scheduler> weak_factory_; | 120 base::WeakPtrFactory<Scheduler> weak_factory_; |
| 120 bool last_set_needs_begin_frame_; | 121 bool last_set_needs_begin_frame_; |
| 121 bool has_pending_begin_frame_; | 122 bool has_pending_begin_frame_; |
| 122 // TODO(brianderson): crbug.com/249806 : Remove safe_to_expect_begin_frame_ | 123 // TODO(brianderson): crbug.com/249806 : Remove safe_to_expect_begin_frame_ |
| 123 // workaround. | 124 // workaround. |
| 124 bool safe_to_expect_begin_frame_; | 125 bool safe_to_expect_begin_frame_; |
| 125 base::TimeTicks last_begin_frame_time_; | 126 BeginFrameArgs last_begin_frame_args_; |
| 126 base::TimeDelta interval_; | |
| 127 | 127 |
| 128 SchedulerStateMachine state_machine_; | 128 SchedulerStateMachine state_machine_; |
| 129 bool inside_process_scheduled_actions_; | 129 bool inside_process_scheduled_actions_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(Scheduler); | 131 DISALLOW_COPY_AND_ASSIGN(Scheduler); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace cc | 134 } // namespace cc |
| 135 | 135 |
| 136 #endif // CC_SCHEDULER_SCHEDULER_H_ | 136 #endif // CC_SCHEDULER_SCHEDULER_H_ |
| OLD | NEW |