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

Side by Side Diff: cc/output/output_surface.h

Issue 199523002: cc: Throttle swaps in Scheduler instead of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase; DidSwapBuffersComplete Created 6 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_OUTPUT_OUTPUT_SURFACE_H_ 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // (namely Android WebView), this is called to determine whether the software 98 // (namely Android WebView), this is called to determine whether the software
99 // device should be used on the current frame. 99 // device should be used on the current frame.
100 virtual bool ForcedDrawToSoftwareDevice() const; 100 virtual bool ForcedDrawToSoftwareDevice() const;
101 101
102 // Called by the compositor on the compositor thread. This is a place where 102 // Called by the compositor on the compositor thread. This is a place where
103 // thread-specific data for the output surface can be initialized, since from 103 // thread-specific data for the output surface can be initialized, since from
104 // this point on the output surface will only be used on the compositor 104 // this point on the output surface will only be used on the compositor
105 // thread. 105 // thread.
106 virtual bool BindToClient(OutputSurfaceClient* client); 106 virtual bool BindToClient(OutputSurfaceClient* client);
107 107
108 // Enable or disable vsync.
109 void SetThrottleFrameProduction(bool enable);
110
108 void InitializeBeginFrameEmulation(base::SingleThreadTaskRunner* task_runner, 111 void InitializeBeginFrameEmulation(base::SingleThreadTaskRunner* task_runner,
109 bool throttle_frame_production,
110 base::TimeDelta interval); 112 base::TimeDelta interval);
111 113
112 void SetMaxFramesPending(int max_frames_pending);
113
114 virtual void EnsureBackbuffer(); 114 virtual void EnsureBackbuffer();
115 virtual void DiscardBackbuffer(); 115 virtual void DiscardBackbuffer();
116 116
117 virtual void Reshape(const gfx::Size& size, float scale_factor); 117 virtual void Reshape(const gfx::Size& size, float scale_factor);
118 virtual gfx::Size SurfaceSize() const; 118 virtual gfx::Size SurfaceSize() const;
119 119
120 virtual void BindFramebuffer(); 120 virtual void BindFramebuffer();
121 121
122 // The implementation may destroy or steal the contents of the CompositorFrame 122 // The implementation may destroy or steal the contents of the CompositorFrame
123 // passed in (though it will not take ownership of the CompositorFrame 123 // passed in (though it will not take ownership of the CompositorFrame
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 void ReleaseGL(); 155 void ReleaseGL();
156 156
157 void PostSwapBuffersComplete(); 157 void PostSwapBuffersComplete();
158 158
159 struct OutputSurface::Capabilities capabilities_; 159 struct OutputSurface::Capabilities capabilities_;
160 scoped_refptr<ContextProvider> context_provider_; 160 scoped_refptr<ContextProvider> context_provider_;
161 scoped_ptr<SoftwareOutputDevice> software_device_; 161 scoped_ptr<SoftwareOutputDevice> software_device_;
162 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; 162 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_;
163 gfx::Size surface_size_; 163 gfx::Size surface_size_;
164 float device_scale_factor_; 164 float device_scale_factor_;
165 base::TimeDelta begin_frame_interval_;
165 166
166 // The FrameRateController is deprecated. 167 // The FrameRateController is deprecated.
167 // Platforms should move to native BeginFrames instead. 168 // Platforms should move to native BeginFrames instead.
168 void CommitVSyncParameters(base::TimeTicks timebase, 169 void CommitVSyncParameters(base::TimeTicks timebase,
169 base::TimeDelta interval); 170 base::TimeDelta interval);
170 virtual void FrameRateControllerTick(bool throttled, 171 virtual void FrameRateControllerTick(const BeginFrameArgs& args) OVERRIDE;
171 const BeginFrameArgs& args) OVERRIDE;
172 scoped_ptr<FrameRateController> frame_rate_controller_; 172 scoped_ptr<FrameRateController> frame_rate_controller_;
173 int max_frames_pending_; 173
174 int pending_swap_buffers_; 174 bool throttle_frame_production_;
175 bool needs_begin_frame_; 175 bool needs_begin_frame_;
176 bool client_ready_for_begin_frame_; 176 bool client_ready_for_begin_frame_;
177 177
178 // This stores a BeginFrame that we couldn't process immediately, 178 // This stores a BeginFrame that we couldn't process immediately,
179 // but might process retroactively in the near future. 179 // but might process retroactively in the near future.
180 BeginFrameArgs skipped_begin_frame_args_; 180 BeginFrameArgs skipped_begin_frame_args_;
181 181
182 // Forwarded to OutputSurfaceClient but threaded through OutputSurface 182 // Forwarded to OutputSurfaceClient but threaded through OutputSurface
183 // first so OutputSurface has a chance to update the FrameRateController 183 // first so OutputSurface has a chance to update the FrameRateController
184 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); 184 void SetNeedsRedrawRect(const gfx::Rect& damage_rect);
(...skipping 14 matching lines...) Expand all
199 void CheckForRetroactiveBeginFrame(); 199 void CheckForRetroactiveBeginFrame();
200 200
201 private: 201 private:
202 OutputSurfaceClient* client_; 202 OutputSurfaceClient* client_;
203 203
204 void SetUpContext3d(); 204 void SetUpContext3d();
205 void ResetContext3d(); 205 void ResetContext3d();
206 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); 206 void SetMemoryPolicy(const ManagedMemoryPolicy& policy);
207 void UpdateAndMeasureGpuLatency(); 207 void UpdateAndMeasureGpuLatency();
208 208
209 bool is_lost_;
210
209 // check_for_retroactive_begin_frame_pending_ is used to avoid posting 211 // check_for_retroactive_begin_frame_pending_ is used to avoid posting
210 // redundant checks for a retroactive BeginFrame. 212 // redundant checks for a retroactive BeginFrame.
211 bool check_for_retroactive_begin_frame_pending_; 213 bool check_for_retroactive_begin_frame_pending_;
212 214
213 bool external_stencil_test_enabled_; 215 bool external_stencil_test_enabled_;
214 216
215 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 217 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
216 218
217 std::deque<unsigned> available_gpu_latency_query_ids_; 219 std::deque<unsigned> available_gpu_latency_query_ids_;
218 std::deque<unsigned> pending_gpu_latency_query_ids_; 220 std::deque<unsigned> pending_gpu_latency_query_ids_;
219 RollingTimeDeltaHistory gpu_latency_history_; 221 RollingTimeDeltaHistory gpu_latency_history_;
220 222
221 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 223 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
222 }; 224 };
223 225
224 } // namespace cc 226 } // namespace cc
225 227
226 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 228 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698