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