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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/thread_checker.h" | |
15 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
16 #include "cc/output/context_provider.h" | 15 #include "cc/output/context_provider.h" |
17 #include "cc/output/overlay_candidate_validator.h" | 16 #include "cc/output/overlay_candidate_validator.h" |
18 #include "cc/output/software_output_device.h" | 17 #include "cc/output/software_output_device.h" |
19 | 18 |
20 namespace base { class SingleThreadTaskRunner; } | 19 namespace base { class SingleThreadTaskRunner; } |
21 | 20 |
22 namespace ui { | 21 namespace ui { |
23 class LatencyInfo; | 22 class LatencyInfo; |
24 } | 23 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ContextProvider* context_provider() const { return context_provider_.get(); } | 105 ContextProvider* context_provider() const { return context_provider_.get(); } |
107 ContextProvider* worker_context_provider() const { | 106 ContextProvider* worker_context_provider() const { |
108 return worker_context_provider_.get(); | 107 return worker_context_provider_.get(); |
109 } | 108 } |
110 SoftwareOutputDevice* software_device() const { | 109 SoftwareOutputDevice* software_device() const { |
111 return software_device_.get(); | 110 return software_device_.get(); |
112 } | 111 } |
113 | 112 |
114 // Called by the compositor on the compositor thread. This is a place where | 113 // Called by the compositor on the compositor thread. This is a place where |
115 // thread-specific data for the output surface can be initialized, since from | 114 // thread-specific data for the output surface can be initialized, since from |
116 // this point to when DetachFromClient() is called the output surface will | 115 // this point on the output surface will only be used on the compositor |
117 // only be used on the compositor thread. | 116 // thread. |
118 virtual bool BindToClient(OutputSurfaceClient* client); | 117 virtual bool BindToClient(OutputSurfaceClient* client); |
119 | 118 |
120 // Called by the compositor on the compositor thread. This is a place where | |
121 // thread-specific data for the output surface can be uninitialized. | |
122 virtual void DetachFromClient(); | |
123 | |
124 virtual void EnsureBackbuffer(); | 119 virtual void EnsureBackbuffer(); |
125 virtual void DiscardBackbuffer(); | 120 virtual void DiscardBackbuffer(); |
126 | 121 |
127 virtual void Reshape(const gfx::Size& size, float scale_factor); | 122 virtual void Reshape(const gfx::Size& size, float scale_factor); |
128 gfx::Size SurfaceSize() const { return surface_size_; } | 123 gfx::Size SurfaceSize() const { return surface_size_; } |
129 float device_scale_factor() const { return device_scale_factor_; } | 124 float device_scale_factor() const { return device_scale_factor_; } |
130 | 125 |
131 // If supported, this causes a ReclaimResources for all resources that are | 126 // If supported, this causes a ReclaimResources for all resources that are |
132 // currently in use. | 127 // currently in use. |
133 virtual void ForceReclaimResources() {} | 128 virtual void ForceReclaimResources() {} |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 OutputSurfaceClient* client_; | 169 OutputSurfaceClient* client_; |
175 | 170 |
176 void PostSwapBuffersComplete(); | 171 void PostSwapBuffersComplete(); |
177 | 172 |
178 struct OutputSurface::Capabilities capabilities_; | 173 struct OutputSurface::Capabilities capabilities_; |
179 scoped_refptr<ContextProvider> context_provider_; | 174 scoped_refptr<ContextProvider> context_provider_; |
180 scoped_refptr<ContextProvider> worker_context_provider_; | 175 scoped_refptr<ContextProvider> worker_context_provider_; |
181 scoped_ptr<SoftwareOutputDevice> software_device_; | 176 scoped_ptr<SoftwareOutputDevice> software_device_; |
182 gfx::Size surface_size_; | 177 gfx::Size surface_size_; |
183 float device_scale_factor_; | 178 float device_scale_factor_; |
184 base::ThreadChecker client_thread_checker_; | |
185 | 179 |
186 void CommitVSyncParameters(base::TimeTicks timebase, | 180 void CommitVSyncParameters(base::TimeTicks timebase, |
187 base::TimeDelta interval); | 181 base::TimeDelta interval); |
188 | 182 |
189 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 183 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
190 void ReclaimResources(const CompositorFrameAck* ack); | 184 void ReclaimResources(const CompositorFrameAck* ack); |
191 void SetExternalStencilTest(bool enabled); | 185 void SetExternalStencilTest(bool enabled); |
192 void SetExternalDrawConstraints( | 186 void SetExternalDrawConstraints( |
193 const gfx::Transform& transform, | 187 const gfx::Transform& transform, |
194 const gfx::Rect& viewport, | 188 const gfx::Rect& viewport, |
195 const gfx::Rect& clip, | 189 const gfx::Rect& clip, |
196 const gfx::Rect& viewport_rect_for_tile_priority, | 190 const gfx::Rect& viewport_rect_for_tile_priority, |
197 const gfx::Transform& transform_for_tile_priority, | 191 const gfx::Transform& transform_for_tile_priority, |
198 bool resourceless_software_draw); | 192 bool resourceless_software_draw); |
199 | 193 |
200 private: | 194 private: |
201 bool external_stencil_test_enabled_; | 195 bool external_stencil_test_enabled_; |
202 | 196 |
203 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 197 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
204 | 198 |
205 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 199 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
206 }; | 200 }; |
207 | 201 |
208 } // namespace cc | 202 } // namespace cc |
209 | 203 |
210 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 204 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |