| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 OutputSurfaceClient* client_; | 178 OutputSurfaceClient* client_; |
| 174 | 179 |
| 175 void PostSwapBuffersComplete(); | 180 void PostSwapBuffersComplete(); |
| 176 | 181 |
| 177 struct OutputSurface::Capabilities capabilities_; | 182 struct OutputSurface::Capabilities capabilities_; |
| 178 scoped_refptr<ContextProvider> context_provider_; | 183 scoped_refptr<ContextProvider> context_provider_; |
| 179 scoped_refptr<ContextProvider> worker_context_provider_; | 184 scoped_refptr<ContextProvider> worker_context_provider_; |
| 180 scoped_ptr<SoftwareOutputDevice> software_device_; | 185 scoped_ptr<SoftwareOutputDevice> software_device_; |
| 181 gfx::Size surface_size_; | 186 gfx::Size surface_size_; |
| 182 float device_scale_factor_; | 187 float device_scale_factor_; |
| 188 base::ThreadChecker client_thread_checker_; |
| 183 | 189 |
| 184 void CommitVSyncParameters(base::TimeTicks timebase, | 190 void CommitVSyncParameters(base::TimeTicks timebase, |
| 185 base::TimeDelta interval); | 191 base::TimeDelta interval); |
| 186 | 192 |
| 187 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 193 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| 188 void ReclaimResources(const CompositorFrameAck* ack); | 194 void ReclaimResources(const CompositorFrameAck* ack); |
| 189 void SetExternalStencilTest(bool enabled); | 195 void SetExternalStencilTest(bool enabled); |
| 190 void SetExternalDrawConstraints( | 196 void SetExternalDrawConstraints( |
| 191 const gfx::Transform& transform, | 197 const gfx::Transform& transform, |
| 192 const gfx::Rect& viewport, | 198 const gfx::Rect& viewport, |
| 193 const gfx::Rect& clip, | 199 const gfx::Rect& clip, |
| 194 const gfx::Rect& viewport_rect_for_tile_priority, | 200 const gfx::Rect& viewport_rect_for_tile_priority, |
| 195 const gfx::Transform& transform_for_tile_priority, | 201 const gfx::Transform& transform_for_tile_priority, |
| 196 bool resourceless_software_draw); | 202 bool resourceless_software_draw); |
| 197 | 203 |
| 198 private: | 204 private: |
| 199 bool external_stencil_test_enabled_; | 205 bool external_stencil_test_enabled_; |
| 200 | 206 |
| 201 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 207 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 202 | 208 |
| 203 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 209 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 204 }; | 210 }; |
| 205 | 211 |
| 206 } // namespace cc | 212 } // namespace cc |
| 207 | 213 |
| 208 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 214 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |