OLD | NEW |
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 28 matching lines...) Expand all Loading... |
39 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 39 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
40 // From here on, it will only be used on the compositor thread. | 40 // From here on, it will only be used on the compositor thread. |
41 // 3. If the 3D context is lost, then the compositor will delete the output | 41 // 3. If the 3D context is lost, then the compositor will delete the output |
42 // surface (on the compositor thread) and go back to step 1. | 42 // surface (on the compositor thread) and go back to step 1. |
43 class CC_EXPORT OutputSurface { | 43 class CC_EXPORT OutputSurface { |
44 public: | 44 public: |
45 enum { | 45 enum { |
46 DEFAULT_MAX_FRAMES_PENDING = 2 | 46 DEFAULT_MAX_FRAMES_PENDING = 2 |
47 }; | 47 }; |
48 | 48 |
| 49 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
| 50 const scoped_refptr<ContextProvider>& worker_context_provider, |
| 51 scoped_ptr<SoftwareOutputDevice> software_device); |
| 52 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
| 53 const scoped_refptr<ContextProvider>& worker_context_provider); |
49 explicit OutputSurface( | 54 explicit OutputSurface( |
50 const scoped_refptr<ContextProvider>& context_provider); | 55 const scoped_refptr<ContextProvider>& context_provider); |
51 | 56 |
52 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); | 57 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); |
53 | 58 |
54 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, | 59 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
55 scoped_ptr<SoftwareOutputDevice> software_device); | 60 scoped_ptr<SoftwareOutputDevice> software_device); |
56 | 61 |
57 virtual ~OutputSurface(); | 62 virtual ~OutputSurface(); |
58 | 63 |
(...skipping 28 matching lines...) Expand all Loading... |
87 return capabilities_; | 92 return capabilities_; |
88 } | 93 } |
89 | 94 |
90 virtual bool HasExternalStencilTest() const; | 95 virtual bool HasExternalStencilTest() const; |
91 | 96 |
92 // Obtain the 3d context or the software device associated with this output | 97 // Obtain the 3d context or the software device associated with this output |
93 // surface. Either of these may return a null pointer, but not both. | 98 // surface. Either of these may return a null pointer, but not both. |
94 // In the event of a lost context, the entire output surface should be | 99 // In the event of a lost context, the entire output surface should be |
95 // recreated. | 100 // recreated. |
96 ContextProvider* context_provider() const { return context_provider_.get(); } | 101 ContextProvider* context_provider() const { return context_provider_.get(); } |
| 102 ContextProvider* worker_context_provider() const { |
| 103 return worker_context_provider_.get(); |
| 104 } |
97 SoftwareOutputDevice* software_device() const { | 105 SoftwareOutputDevice* software_device() const { |
98 return software_device_.get(); | 106 return software_device_.get(); |
99 } | 107 } |
100 | 108 |
101 // Called by the compositor on the compositor thread. This is a place where | 109 // Called by the compositor on the compositor thread. This is a place where |
102 // thread-specific data for the output surface can be initialized, since from | 110 // thread-specific data for the output surface can be initialized, since from |
103 // this point on the output surface will only be used on the compositor | 111 // this point on the output surface will only be used on the compositor |
104 // thread. | 112 // thread. |
105 virtual bool BindToClient(OutputSurfaceClient* client); | 113 virtual bool BindToClient(OutputSurfaceClient* client); |
106 | 114 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 150 |
143 void DidLoseOutputSurface(); | 151 void DidLoseOutputSurface(); |
144 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); | 152 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); |
145 | 153 |
146 protected: | 154 protected: |
147 OutputSurfaceClient* client_; | 155 OutputSurfaceClient* client_; |
148 | 156 |
149 // Synchronously initialize context3d and enter hardware mode. | 157 // Synchronously initialize context3d and enter hardware mode. |
150 // This can only supported in threaded compositing mode. | 158 // This can only supported in threaded compositing mode. |
151 bool InitializeAndSetContext3d( | 159 bool InitializeAndSetContext3d( |
152 scoped_refptr<ContextProvider> context_provider); | 160 scoped_refptr<ContextProvider> context_provider, |
| 161 scoped_refptr<ContextProvider> worker_context_provider); |
153 void ReleaseGL(); | 162 void ReleaseGL(); |
154 | 163 |
155 void PostSwapBuffersComplete(); | 164 void PostSwapBuffersComplete(); |
156 | 165 |
157 struct OutputSurface::Capabilities capabilities_; | 166 struct OutputSurface::Capabilities capabilities_; |
158 scoped_refptr<ContextProvider> context_provider_; | 167 scoped_refptr<ContextProvider> context_provider_; |
| 168 scoped_refptr<ContextProvider> worker_context_provider_; |
159 scoped_ptr<SoftwareOutputDevice> software_device_; | 169 scoped_ptr<SoftwareOutputDevice> software_device_; |
160 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; | 170 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; |
161 gfx::Size surface_size_; | 171 gfx::Size surface_size_; |
162 float device_scale_factor_; | 172 float device_scale_factor_; |
163 | 173 |
164 void CommitVSyncParameters(base::TimeTicks timebase, | 174 void CommitVSyncParameters(base::TimeTicks timebase, |
165 base::TimeDelta interval); | 175 base::TimeDelta interval); |
166 | 176 |
167 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 177 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
168 void ReclaimResources(const CompositorFrameAck* ack); | 178 void ReclaimResources(const CompositorFrameAck* ack); |
(...skipping 13 matching lines...) Expand all Loading... |
182 bool external_stencil_test_enabled_; | 192 bool external_stencil_test_enabled_; |
183 | 193 |
184 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 194 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
185 | 195 |
186 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 196 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
187 }; | 197 }; |
188 | 198 |
189 } // namespace cc | 199 } // namespace cc |
190 | 200 |
191 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 201 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |