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

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

Issue 16863005: cc: Add BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@nofrc12
Patch Set: Rebase Created 7 years, 6 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 | « cc/output/begin_frame_args.cc ('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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 23 matching lines...) Expand all
34 34
35 // Represents the output surface for a compositor. The compositor owns 35 // Represents the output surface for a compositor. The compositor owns
36 // and manages its destruction. Its lifetime is: 36 // and manages its destruction. Its lifetime is:
37 // 1. Created on the main thread by the LayerTreeHost through its client. 37 // 1. Created on the main thread by the LayerTreeHost through its client.
38 // 2. Passed to the compositor thread and bound to a client via BindToClient. 38 // 2. Passed to the compositor thread and bound to a client via BindToClient.
39 // From here on, it will only be used on the compositor thread. 39 // From here on, it will only be used on the compositor thread.
40 // 3. If the 3D context is lost, then the compositor will delete the output 40 // 3. If the 3D context is lost, then the compositor will delete the output
41 // surface (on the compositor thread) and go back to step 1. 41 // surface (on the compositor thread) and go back to step 1.
42 class CC_EXPORT OutputSurface : public FrameRateControllerClient { 42 class CC_EXPORT OutputSurface : public FrameRateControllerClient {
43 public: 43 public:
44 enum {
45 DEFAULT_MAX_FRAMES_PENDING = 2
46 };
47
44 explicit OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); 48 explicit OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
45 49
46 explicit OutputSurface(scoped_ptr<cc::SoftwareOutputDevice> software_device); 50 explicit OutputSurface(scoped_ptr<cc::SoftwareOutputDevice> software_device);
47 51
48 OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d, 52 OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
49 scoped_ptr<cc::SoftwareOutputDevice> software_device); 53 scoped_ptr<cc::SoftwareOutputDevice> software_device);
50 54
51 virtual ~OutputSurface(); 55 virtual ~OutputSurface();
52 56
53 struct Capabilities { 57 struct Capabilities {
54 Capabilities() 58 Capabilities()
55 : delegated_rendering(false), 59 : delegated_rendering(false),
56 max_frames_pending(0), 60 max_frames_pending(0),
57 deferred_gl_initialization(false) {} 61 deferred_gl_initialization(false),
58 62 has_parent_compositor(true) {}
59 bool delegated_rendering; 63 bool delegated_rendering;
60 int max_frames_pending; 64 int max_frames_pending;
61 bool deferred_gl_initialization; 65 bool deferred_gl_initialization;
66 // This doesn't handle the <webview> case, but once BeginFrame is
67 // supported natively, we shouldn't need has_parent_compositor.
68 bool has_parent_compositor;
62 }; 69 };
63 70
64 const Capabilities& capabilities() const { 71 const Capabilities& capabilities() const {
65 return capabilities_; 72 return capabilities_;
66 } 73 }
67 74
68 // Obtain the 3d context or the software device associated with this output 75 // Obtain the 3d context or the software device associated with this output
69 // surface. Either of these may return a null pointer, but not both. 76 // surface. Either of these may return a null pointer, but not both.
70 // In the event of a lost context, the entire output surface should be 77 // In the event of a lost context, the entire output surface should be
71 // recreated. 78 // recreated.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 bool has_gl_discard_backbuffer_; 142 bool has_gl_discard_backbuffer_;
136 bool has_swap_buffers_complete_callback_; 143 bool has_swap_buffers_complete_callback_;
137 gfx::Size surface_size_; 144 gfx::Size surface_size_;
138 float device_scale_factor_; 145 float device_scale_factor_;
139 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; 146 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_;
140 147
141 // The FrameRateController is deprecated. 148 // The FrameRateController is deprecated.
142 // Platforms should move to native BeginFrames instead. 149 // Platforms should move to native BeginFrames instead.
143 void OnVSyncParametersChanged(base::TimeTicks timebase, 150 void OnVSyncParametersChanged(base::TimeTicks timebase,
144 base::TimeDelta interval); 151 base::TimeDelta interval);
145 virtual void FrameRateControllerTick(bool throttled) OVERRIDE; 152 virtual void FrameRateControllerTick(bool throttled,
153 const BeginFrameArgs& args) OVERRIDE;
146 scoped_ptr<FrameRateController> frame_rate_controller_; 154 scoped_ptr<FrameRateController> frame_rate_controller_;
147 int max_frames_pending_; 155 int max_frames_pending_;
148 int pending_swap_buffers_; 156 int pending_swap_buffers_;
149 bool begin_frame_pending_; 157 bool begin_frame_pending_;
150 158
151 // Forwarded to OutputSurfaceClient but threaded through OutputSurface 159 // Forwarded to OutputSurfaceClient but threaded through OutputSurface
152 // first so OutputSurface has a chance to update the FrameRateController 160 // first so OutputSurface has a chance to update the FrameRateController
153 bool HasClient() { return !!client_; } 161 bool HasClient() { return !!client_; }
154 void SetNeedsRedrawRect(gfx::Rect damage_rect); 162 void SetNeedsRedrawRect(gfx::Rect damage_rect);
155 void BeginFrame(base::TimeTicks frame_time); 163 void BeginFrame(const BeginFrameArgs& args);
156 void DidSwapBuffers(); 164 void DidSwapBuffers();
157 void OnSwapBuffersComplete(const CompositorFrameAck* ack); 165 void OnSwapBuffersComplete(const CompositorFrameAck* ack);
158 void DidLoseOutputSurface(); 166 void DidLoseOutputSurface();
159 void SetExternalDrawConstraints(const gfx::Transform& transform, 167 void SetExternalDrawConstraints(const gfx::Transform& transform,
160 gfx::Rect viewport); 168 gfx::Rect viewport);
161 169
162 private: 170 private:
163 OutputSurfaceClient* client_; 171 OutputSurfaceClient* client_;
164 friend class OutputSurfaceCallbacks; 172 friend class OutputSurfaceCallbacks;
165 173
166 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); 174 void SetContext3D(scoped_ptr<WebKit::WebGraphicsContext3D> context3d);
167 175
168 DISALLOW_COPY_AND_ASSIGN(OutputSurface); 176 DISALLOW_COPY_AND_ASSIGN(OutputSurface);
169 }; 177 };
170 178
171 } // namespace cc 179 } // namespace cc
172 180
173 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ 181 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/output/begin_frame_args.cc ('k') | cc/output/output_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698