| 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 "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
| 15 #include "cc/output/context_provider.h" | 15 #include "cc/output/context_provider.h" |
| 16 #include "cc/output/overlay_candidate_validator.h" | 16 #include "cc/output/overlay_candidate_validator.h" |
| 17 #include "cc/output/software_output_device.h" | 17 #include "cc/output/software_output_device.h" |
| 18 #include "cc/resources/scoped_gpu_raster.h" |
| 18 | 19 |
| 19 namespace base { class SingleThreadTaskRunner; } | 20 namespace base { class SingleThreadTaskRunner; } |
| 20 | 21 |
| 21 namespace ui { struct LatencyInfo; } | 22 namespace ui { struct LatencyInfo; } |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| 24 class Rect; | 25 class Rect; |
| 25 class Size; | 26 class Size; |
| 26 class Transform; | 27 class Transform; |
| 27 } | 28 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 42 // surface (on the compositor thread) and go back to step 1. | 43 // surface (on the compositor thread) and go back to step 1. |
| 43 class CC_EXPORT OutputSurface { | 44 class CC_EXPORT OutputSurface { |
| 44 public: | 45 public: |
| 45 enum { | 46 enum { |
| 46 DEFAULT_MAX_FRAMES_PENDING = 2 | 47 DEFAULT_MAX_FRAMES_PENDING = 2 |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 explicit OutputSurface( | 50 explicit OutputSurface( |
| 50 const scoped_refptr<ContextProvider>& context_provider); | 51 const scoped_refptr<ContextProvider>& context_provider); |
| 51 | 52 |
| 53 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
| 54 const scoped_refptr<ContextProvider>& worker_context_provider); |
| 55 |
| 52 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); | 56 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); |
| 53 | 57 |
| 54 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, | 58 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
| 59 const scoped_refptr<ContextProvider>& worker_context_provider, |
| 55 scoped_ptr<SoftwareOutputDevice> software_device); | 60 scoped_ptr<SoftwareOutputDevice> software_device); |
| 56 | 61 |
| 57 virtual ~OutputSurface(); | 62 virtual ~OutputSurface(); |
| 58 | 63 |
| 59 struct Capabilities { | 64 struct Capabilities { |
| 60 Capabilities() | 65 Capabilities() |
| 61 : delegated_rendering(false), | 66 : delegated_rendering(false), |
| 62 max_frames_pending(0), | 67 max_frames_pending(0), |
| 63 deferred_gl_initialization(false), | 68 deferred_gl_initialization(false), |
| 64 draw_and_swap_full_viewport_every_frame(false), | 69 draw_and_swap_full_viewport_every_frame(false), |
| (...skipping 22 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); |
| 153 void ReleaseGL(); | 161 void ReleaseGL(); |
| 154 | 162 |
| 155 void PostSwapBuffersComplete(); | 163 void PostSwapBuffersComplete(); |
| 156 | 164 |
| 157 struct OutputSurface::Capabilities capabilities_; | 165 struct OutputSurface::Capabilities capabilities_; |
| 158 scoped_refptr<ContextProvider> context_provider_; | 166 scoped_refptr<ContextProvider> context_provider_; |
| 167 scoped_refptr<ContextProvider> worker_context_provider_; |
| 159 scoped_ptr<SoftwareOutputDevice> software_device_; | 168 scoped_ptr<SoftwareOutputDevice> software_device_; |
| 160 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; | 169 scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_; |
| 161 gfx::Size surface_size_; | 170 gfx::Size surface_size_; |
| 162 float device_scale_factor_; | 171 float device_scale_factor_; |
| 163 | 172 |
| 164 void CommitVSyncParameters(base::TimeTicks timebase, | 173 void CommitVSyncParameters(base::TimeTicks timebase, |
| 165 base::TimeDelta interval); | 174 base::TimeDelta interval); |
| 166 | 175 |
| 167 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 176 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| 168 void ReclaimResources(const CompositorFrameAck* ack); | 177 void ReclaimResources(const CompositorFrameAck* ack); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 182 bool external_stencil_test_enabled_; | 191 bool external_stencil_test_enabled_; |
| 183 | 192 |
| 184 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 193 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 185 | 194 |
| 186 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 195 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 187 }; | 196 }; |
| 188 | 197 |
| 189 } // namespace cc | 198 } // namespace cc |
| 190 | 199 |
| 191 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 200 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |