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

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

Issue 23503003: cc: Add readback and forced draw states to the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedReorg3
Patch Set: Address enne's commetns 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
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | cc/scheduler/scheduler_state_machine.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/time/time.h" 12 #include "base/time/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/output/begin_frame_args.h"
15 #include "cc/scheduler/scheduler_settings.h" 15 #include "cc/scheduler/scheduler_settings.h"
16 #include "cc/scheduler/scheduler_state_machine.h" 16 #include "cc/scheduler/scheduler_state_machine.h"
17 #include "cc/trees/layer_tree_host.h" 17 #include "cc/trees/layer_tree_host.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 class Thread; 21 class Thread;
22 22
23 struct ScheduledActionDrawAndSwapResult { 23 struct DrawSwapReadbackResult {
24 ScheduledActionDrawAndSwapResult() 24 DrawSwapReadbackResult()
25 : did_draw(false), 25 : did_draw(false), did_swap(false), did_readback(false) {}
26 did_swap(false) {} 26 DrawSwapReadbackResult(bool did_draw, bool did_swap, bool did_readback)
27 ScheduledActionDrawAndSwapResult(bool did_draw, bool did_swap) 27 : did_draw(did_draw), did_swap(did_swap), did_readback(did_readback) {}
28 : did_draw(did_draw),
29 did_swap(did_swap) {}
30 bool did_draw; 28 bool did_draw;
31 bool did_swap; 29 bool did_swap;
30 bool did_readback;
32 }; 31 };
33 32
34 class SchedulerClient { 33 class SchedulerClient {
35 public: 34 public:
36 virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0; 35 virtual void SetNeedsBeginFrameOnImplThread(bool enable) = 0;
37 virtual void ScheduledActionSendBeginFrameToMainThread() = 0; 36 virtual void ScheduledActionSendBeginFrameToMainThread() = 0;
38 virtual ScheduledActionDrawAndSwapResult 37 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapIfPossible() = 0;
39 ScheduledActionDrawAndSwapIfPossible() = 0; 38 virtual DrawSwapReadbackResult ScheduledActionDrawAndSwapForced() = 0;
40 virtual ScheduledActionDrawAndSwapResult 39 virtual DrawSwapReadbackResult ScheduledActionDrawAndReadback() = 0;
41 ScheduledActionDrawAndSwapForced() = 0;
42 virtual void ScheduledActionCommit() = 0; 40 virtual void ScheduledActionCommit() = 0;
43 virtual void ScheduledActionUpdateVisibleTiles() = 0; 41 virtual void ScheduledActionUpdateVisibleTiles() = 0;
44 virtual void ScheduledActionActivatePendingTree() = 0; 42 virtual void ScheduledActionActivatePendingTree() = 0;
45 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0; 43 virtual void ScheduledActionBeginOutputSurfaceCreation() = 0;
46 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0; 44 virtual void ScheduledActionAcquireLayerTexturesForMainThread() = 0;
47 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0; 45 virtual void DidAnticipatedDrawTimeChange(base::TimeTicks time) = 0;
48 virtual base::TimeDelta DrawDurationEstimate() = 0; 46 virtual base::TimeDelta DrawDurationEstimate() = 0;
49 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() = 0; 47 virtual base::TimeDelta BeginFrameToCommitDurationEstimate() = 0;
50 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0; 48 virtual base::TimeDelta CommitToActivateDurationEstimate() = 0;
51 49
(...skipping 13 matching lines...) Expand all
65 63
66 void SetCanStart(); 64 void SetCanStart();
67 65
68 void SetVisible(bool visible); 66 void SetVisible(bool visible);
69 void SetCanDraw(bool can_draw); 67 void SetCanDraw(bool can_draw);
70 void NotifyReadyToActivate(); 68 void NotifyReadyToActivate();
71 69
72 void SetNeedsCommit(); 70 void SetNeedsCommit();
73 71
74 // Like SetNeedsCommit(), but ensures a commit will definitely happen even if 72 // Like SetNeedsCommit(), but ensures a commit will definitely happen even if
75 // we are not visible. 73 // we are not visible. Will eventually result in a forced draw internally.
76 void SetNeedsForcedCommit(); 74 void SetNeedsForcedCommitForReadback();
77 75
78 void SetNeedsRedraw(); 76 void SetNeedsRedraw();
79 77
80 void SetMainThreadNeedsLayerTextures(); 78 void SetMainThreadNeedsLayerTextures();
81 79
82 // Like SetNeedsRedraw(), but ensures the draw will definitely happen even if
83 // we are not visible.
84 void SetNeedsForcedRedraw();
85
86 void DidSwapUseIncompleteTile(); 80 void DidSwapUseIncompleteTile();
87 81
88 void FinishCommit(); 82 void FinishCommit();
89 void BeginFrameAbortedByMainThread(bool did_handle); 83 void BeginFrameAbortedByMainThread(bool did_handle);
90 84
91 void DidLoseOutputSurface(); 85 void DidLoseOutputSurface();
92 void DidCreateAndInitializeOutputSurface(); 86 void DidCreateAndInitializeOutputSurface();
93 bool HasInitializedOutputSurface() const { 87 bool HasInitializedOutputSurface() const {
94 return state_machine_.HasInitializedOutputSurface(); 88 return state_machine_.HasInitializedOutputSurface();
95 } 89 }
(...skipping 13 matching lines...) Expand all
109 return state_machine_.AsValue().Pass(); 103 return state_machine_.AsValue().Pass();
110 } 104 }
111 105
112 private: 106 private:
113 Scheduler(SchedulerClient* client, 107 Scheduler(SchedulerClient* client,
114 const SchedulerSettings& scheduler_settings); 108 const SchedulerSettings& scheduler_settings);
115 109
116 void SetupNextBeginFrameIfNeeded(); 110 void SetupNextBeginFrameIfNeeded();
117 void DrawAndSwapIfPossible(); 111 void DrawAndSwapIfPossible();
118 void DrawAndSwapForced(); 112 void DrawAndSwapForced();
113 void DrawAndReadback();
119 void ProcessScheduledActions(); 114 void ProcessScheduledActions();
120 115
121 const SchedulerSettings settings_; 116 const SchedulerSettings settings_;
122 SchedulerClient* client_; 117 SchedulerClient* client_;
123 118
124 base::WeakPtrFactory<Scheduler> weak_factory_; 119 base::WeakPtrFactory<Scheduler> weak_factory_;
125 bool last_set_needs_begin_frame_; 120 bool last_set_needs_begin_frame_;
126 bool has_pending_begin_frame_; 121 bool has_pending_begin_frame_;
127 // TODO(brianderson): crbug.com/249806 : Remove safe_to_expect_begin_frame_ 122 // TODO(brianderson): crbug.com/249806 : Remove safe_to_expect_begin_frame_
128 // workaround. 123 // workaround.
129 bool safe_to_expect_begin_frame_; 124 bool safe_to_expect_begin_frame_;
130 BeginFrameArgs last_begin_frame_args_; 125 BeginFrameArgs last_begin_frame_args_;
131 126
132 SchedulerStateMachine state_machine_; 127 SchedulerStateMachine state_machine_;
133 bool inside_process_scheduled_actions_; 128 bool inside_process_scheduled_actions_;
134 129
135 DISALLOW_COPY_AND_ASSIGN(Scheduler); 130 DISALLOW_COPY_AND_ASSIGN(Scheduler);
136 }; 131 };
137 132
138 } // namespace cc 133 } // namespace cc
139 134
140 #endif // CC_SCHEDULER_SCHEDULER_H_ 135 #endif // CC_SCHEDULER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/scheduler/scheduler.cc » ('j') | cc/scheduler/scheduler_state_machine.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698