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

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

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/output_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13 matching lines...) Expand all
24 namespace gfx { 24 namespace gfx {
25 class Rect; 25 class Rect;
26 class Size; 26 class Size;
27 class Transform; 27 class Transform;
28 } 28 }
29 29
30 namespace cc { 30 namespace cc {
31 31
32 class CompositorFrame; 32 class CompositorFrame;
33 class CompositorFrameAck; 33 class CompositorFrameAck;
34 class OutputSurfaceClient;
35 struct BeginFrameArgs;
34 struct ManagedMemoryPolicy; 36 struct ManagedMemoryPolicy;
35 class OutputSurfaceClient;
36 37
37 // Represents the output surface for a compositor. The compositor owns 38 // Represents the output surface for a compositor. The compositor owns
38 // and manages its destruction. Its lifetime is: 39 // and manages its destruction. Its lifetime is:
39 // 1. Created on the main thread by the LayerTreeHost through its client. 40 // 1. Created on the main thread by the LayerTreeHost through its client.
40 // 2. Passed to the compositor thread and bound to a client via BindToClient. 41 // 2. Passed to the compositor thread and bound to a client via BindToClient.
41 // From here on, it will only be used on the compositor thread. 42 // From here on, it will only be used on the compositor thread.
42 // 3. If the 3D context is lost, then the compositor will delete the output 43 // 3. If the 3D context is lost, then the compositor will delete the output
43 // surface (on the compositor thread) and go back to step 1. 44 // surface (on the compositor thread) and go back to step 1.
44 class CC_EXPORT OutputSurface { 45 class CC_EXPORT OutputSurface {
45 public: 46 public:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 120
120 // Notifies frame-rate smoothness preference. If true, all non-critical 121 // Notifies frame-rate smoothness preference. If true, all non-critical
121 // processing should be stopped, or lowered in priority. 122 // processing should be stopped, or lowered in priority.
122 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} 123 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {}
123 124
124 // Requests a BeginFrame notification from the output surface. The 125 // Requests a BeginFrame notification from the output surface. The
125 // notification will be delivered by calling 126 // notification will be delivered by calling
126 // OutputSurfaceClient::BeginFrame until the callback is disabled. 127 // OutputSurfaceClient::BeginFrame until the callback is disabled.
127 virtual void SetNeedsBeginFrame(bool enable) {} 128 virtual void SetNeedsBeginFrame(bool enable) {}
128 129
129 bool HasClient() { return !!client_; } 130 bool HasClient() const { return !!client_; }
130 131
131 // Returns an estimate of the current GPU latency. When only a software 132 // Returns an estimate of the current GPU latency. When only a software
132 // device is present, returns 0. 133 // device is present, returns 0.
133 base::TimeDelta GpuLatencyEstimate(); 134 base::TimeDelta GpuLatencyEstimate();
134 135
135 // Get the class capable of informing cc of hardware overlay capability. 136 // Get the class capable of informing cc of hardware overlay capability.
136 OverlayCandidateValidator* overlay_candidate_validator() const { 137 OverlayCandidateValidator* overlay_candidate_validator() const {
137 return overlay_candidate_validator_.get(); 138 return overlay_candidate_validator_.get();
138 } 139 }
139 140
141 void BeginFrame(const BeginFrameArgs& args) const;
142
143 base::WeakPtr<OutputSurface> GetWeakPtr() {
144 return weak_ptr_factory_.GetWeakPtr();
145 }
146
140 protected: 147 protected:
141 OutputSurfaceClient* client_; 148 OutputSurfaceClient* client_;
142 149
143 // Synchronously initialize context3d and enter hardware mode. 150 // Synchronously initialize context3d and enter hardware mode.
144 // This can only supported in threaded compositing mode. 151 // This can only supported in threaded compositing mode.
145 bool InitializeAndSetContext3d( 152 bool InitializeAndSetContext3d(
146 scoped_refptr<ContextProvider> context_provider); 153 scoped_refptr<ContextProvider> context_provider);
147 void ReleaseGL(); 154 void ReleaseGL();
148 155
149 void PostSwapBuffersComplete(); 156 void PostSwapBuffersComplete();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 RollingTimeDeltaHistory gpu_latency_history_; 190 RollingTimeDeltaHistory gpu_latency_history_;
184 191
185 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 192 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
186 193
187 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 194 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
188 }; 195 };
189 196
190 } // namespace cc 197 } // namespace cc
191 198
192 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 199 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.h ('k') | cc/output/output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698