Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: cc/scheduler/scheduler.h

Issue 23796002: cc: Implement deadine scheduling disabled by default (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedReadback4
Patch Set: disable by default everywhere Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/cancelable_callback.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
14 #include "cc/output/begin_frame_args.h" 15 #include "cc/output/begin_frame_args.h"
15 #include "cc/scheduler/scheduler_settings.h" 16 #include "cc/scheduler/scheduler_settings.h"
16 #include "cc/scheduler/scheduler_state_machine.h" 17 #include "cc/scheduler/scheduler_state_machine.h"
17 #include "cc/trees/layer_tree_host.h" 18 #include "cc/trees/layer_tree_host.h"
18 19
19 namespace cc { 20 namespace cc {
20 21
(...skipping 19 matching lines...) Expand all
40 virtual void ScheduledActionCommit() = 0; 41 virtual void ScheduledActionCommit() = 0;
41 virtual void ScheduledActionUpdateVisibleTiles() = 0; 42 virtual void ScheduledActionUpdateVisibleTiles() = 0;
42 virtual void ScheduledActionActivatePendingTree() = 0; 43 virtual void ScheduledActionActivatePendingTree() = 0;
43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; 44 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0;
44 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; 45 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0;
45 virtual void ScheduledActionManageTiles() = 0; 46 virtual void ScheduledActionManageTiles() = 0;
46 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; 47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0;
47 virtual base::TimeDelta DrawDurationEstimate() = 0; 48 virtual base::TimeDelta DrawDurationEstimate() = 0;
48 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() = 0; 49 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() = 0;
49 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; 50 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0;
51 virtual void PostBeginFrameDeadline(const base::Closure& closure,
52 base::TimeTicks deadline) = 0;
53 virtual void DidBeginFrameDeadlineOnImplThread() = 0;
50 54
51 protected: 55 protected:
52 virtual ~SchedulerClient() {} 56 virtual ~SchedulerClient() {}
53 }; 57 };
54 58
55 class CC_EXPORT Scheduler { 59 class CC_EXPORT Scheduler {
56 public: 60 public:
57 static scoped_ptr<Scheduler> Create( 61 static scoped_ptr<Scheduler> Create(
58 SchedulerClient* client, 62 SchedulerClient* client,
59 const SchedulerSettings& scheduler_settings) { 63 const SchedulerSettings& scheduler_settings) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 return state_machine_.ManageTilesPending(); 101 return state_machine_.ManageTilesPending();
98 } 102 }
99 103
100 bool WillDrawIfNeeded() const; 104 bool WillDrawIfNeeded() const;
101 105
102 base::TimeTicks AnticipatedDrawTime(); 106 base::TimeTicks AnticipatedDrawTime();
103 107
104 base::TimeTicks LastBeginFrameOnImplThreadTime(); 108 base::TimeTicks LastBeginFrameOnImplThreadTime();
105 109
106 void BeginFrame(const BeginFrameArgs& args); 110 void BeginFrame(const BeginFrameArgs& args);
111 void OnBeginFrameDeadline();
107 void PollForAnticipatedDrawTriggers(); 112 void PollForAnticipatedDrawTriggers();
108 113
109 scoped_ptr<base::Value> StateAsValue() { 114 scoped_ptr<base::Value> StateAsValue() {
110 return state_machine_.AsValue().Pass(); 115 return state_machine_.AsValue().Pass();
111 } 116 }
112 117
113 bool IsInsideAction(SchedulerStateMachine::Action action) { 118 bool IsInsideAction(SchedulerStateMachine::Action action) {
114 return inside_action_ == action; 119 return inside_action_ == action;
115 } 120 }
116 121
117 private: 122 private:
118 Scheduler(SchedulerClient* client, 123 Scheduler(SchedulerClient* client,
119 const SchedulerSettings& scheduler_settings); 124 const SchedulerSettings& scheduler_settings);
120 125
126 void PostBeginFrameDeadline(base::TimeTicks deadline);
121 void SetupNextBeginFrameIfNeeded(); 127 void SetupNextBeginFrameIfNeeded();
128 void ActivatePendingTree();
122 void DrawAndSwapIfPossible(); 129 void DrawAndSwapIfPossible();
123 void DrawAndSwapForced(); 130 void DrawAndSwapForced();
124 void DrawAndReadback(); 131 void DrawAndReadback();
125 void ProcessScheduledActions(); 132 void ProcessScheduledActions();
126 133
127 const SchedulerSettings settings_; 134 const SchedulerSettings settings_;
128 SchedulerClient* client_; 135 SchedulerClient* client_;
129 136
130 base::WeakPtrFactory<Scheduler> weak_factory_; 137 base::WeakPtrFactory<Scheduler> weak_factory_;
131 bool last_set_needs_begin_frame_; 138 bool last_set_needs_begin_frame_;
132 BeginFrameArgs last_begin_frame_args_; 139 BeginFrameArgs last_begin_frame_args_;
140 base::CancelableClosure begin_frame_deadline_closure_;
133 base::CancelableClosure poll_for_draw_triggers_closure_; 141 base::CancelableClosure poll_for_draw_triggers_closure_;
134 142
135 SchedulerStateMachine state_machine_; 143 SchedulerStateMachine state_machine_;
136 bool inside_process_scheduled_actions_; 144 bool inside_process_scheduled_actions_;
137 SchedulerStateMachine::Action inside_action_; 145 SchedulerStateMachine::Action inside_action_;
138 146
139 DISALLOW_COPY_AND_ASSIGN(Scheduler); 147 DISALLOW_COPY_AND_ASSIGN(Scheduler);
140 }; 148 };
141 149
142 } // namespace cc 150 } // namespace cc
143 151
144 #endif // CC_SCHEDULER_SCHEDULER_H_ 152 #endif // CC_SCHEDULER_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698