| 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" | |
| 15 #include "cc/output/context_provider.h" | 14 #include "cc/output/context_provider.h" |
| 16 #include "cc/output/overlay_candidate_validator.h" | 15 #include "cc/output/overlay_candidate_validator.h" |
| 17 #include "cc/output/software_output_device.h" | 16 #include "cc/output/software_output_device.h" |
| 18 | 17 |
| 19 namespace base { class SingleThreadTaskRunner; } | 18 namespace base { class SingleThreadTaskRunner; } |
| 20 | 19 |
| 21 namespace ui { struct LatencyInfo; } | 20 namespace ui { struct LatencyInfo; } |
| 22 | 21 |
| 23 namespace gfx { | 22 namespace gfx { |
| 24 class Rect; | 23 class Rect; |
| 25 class Size; | 24 class Size; |
| 26 class Transform; | 25 class Transform; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace cc { | 28 namespace cc { |
| 30 | 29 |
| 31 class CompositorFrame; | 30 class CompositorFrame; |
| 32 class CompositorFrameAck; | 31 class CompositorFrameAck; |
| 33 struct ManagedMemoryPolicy; | |
| 34 class OutputSurfaceClient; | 32 class OutputSurfaceClient; |
| 35 | 33 |
| 36 // Represents the output surface for a compositor. The compositor owns | 34 // Represents the output surface for a compositor. The compositor owns |
| 37 // and manages its destruction. Its lifetime is: | 35 // and manages its destruction. Its lifetime is: |
| 38 // 1. Created on the main thread by the LayerTreeHost through its client. | 36 // 1. Created on the main thread by the LayerTreeHost through its client. |
| 39 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 37 // 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. | 38 // 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 | 39 // 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. | 40 // surface (on the compositor thread) and go back to step 1. |
| 43 class CC_EXPORT OutputSurface { | 41 class OutputSurface { |
| 44 public: | 42 public: |
| 45 enum { | 43 enum { |
| 46 DEFAULT_MAX_FRAMES_PENDING = 2 | 44 DEFAULT_MAX_FRAMES_PENDING = 2 |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, | 47 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
| 50 const scoped_refptr<ContextProvider>& worker_context_provider, | 48 const scoped_refptr<ContextProvider>& worker_context_provider, |
| 51 scoped_ptr<SoftwareOutputDevice> software_device); | 49 scoped_ptr<SoftwareOutputDevice> software_device); |
| 52 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, | 50 OutputSurface(const scoped_refptr<ContextProvider>& context_provider, |
| 53 const scoped_refptr<ContextProvider>& worker_context_provider); | 51 const scoped_refptr<ContextProvider>& worker_context_provider); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 140 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
| 143 | 141 |
| 144 bool HasClient() { return !!client_; } | 142 bool HasClient() { return !!client_; } |
| 145 | 143 |
| 146 // Get the class capable of informing cc of hardware overlay capability. | 144 // Get the class capable of informing cc of hardware overlay capability. |
| 147 OverlayCandidateValidator* overlay_candidate_validator() const { | 145 OverlayCandidateValidator* overlay_candidate_validator() const { |
| 148 return overlay_candidate_validator_.get(); | 146 return overlay_candidate_validator_.get(); |
| 149 } | 147 } |
| 150 | 148 |
| 151 void DidLoseOutputSurface(); | 149 void DidLoseOutputSurface(); |
| 152 void SetMemoryPolicy(const ManagedMemoryPolicy& policy); | |
| 153 | 150 |
| 154 protected: | 151 protected: |
| 155 OutputSurfaceClient* client_; | 152 OutputSurfaceClient* client_; |
| 156 | 153 |
| 157 // Synchronously initialize context3d and enter hardware mode. | 154 // Synchronously initialize context3d and enter hardware mode. |
| 158 // This can only supported in threaded compositing mode. | 155 // This can only supported in threaded compositing mode. |
| 159 bool InitializeAndSetContext3d( | 156 bool InitializeAndSetContext3d( |
| 160 scoped_refptr<ContextProvider> context_provider, | 157 scoped_refptr<ContextProvider> context_provider, |
| 161 scoped_refptr<ContextProvider> worker_context_provider); | 158 scoped_refptr<ContextProvider> worker_context_provider); |
| 162 void ReleaseGL(); | 159 void ReleaseGL(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 192 bool external_stencil_test_enabled_; | 189 bool external_stencil_test_enabled_; |
| 193 | 190 |
| 194 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 191 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 195 | 192 |
| 196 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 193 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 197 }; | 194 }; |
| 198 | 195 |
| 199 } // namespace cc | 196 } // namespace cc |
| 200 | 197 |
| 201 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 198 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |