| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace gfx { | 23 namespace gfx { |
| 24 class Rect; | 24 class Rect; |
| 25 class Size; | 25 class Size; |
| 26 class Transform; | 26 class Transform; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace cc { | 29 namespace cc { |
| 30 | 30 |
| 31 class CompositorFrame; | 31 class CompositorFrame; |
| 32 class CompositorFrameAck; | 32 class CompositorFrameAck; |
| 33 class OutputSurfaceClient; |
| 34 struct BeginFrameArgs; |
| 33 struct ManagedMemoryPolicy; | 35 struct ManagedMemoryPolicy; |
| 34 class OutputSurfaceClient; | |
| 35 | 36 |
| 36 // Represents the output surface for a compositor. The compositor owns | 37 // Represents the output surface for a compositor. The compositor owns |
| 37 // and manages its destruction. Its lifetime is: | 38 // and manages its destruction. Its lifetime is: |
| 38 // 1. Created on the main thread by the LayerTreeHost through its client. | 39 // 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. | 40 // 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. | 41 // 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 | 42 // 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. | 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: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 119 |
| 119 // Notifies frame-rate smoothness preference. If true, all non-critical | 120 // Notifies frame-rate smoothness preference. If true, all non-critical |
| 120 // processing should be stopped, or lowered in priority. | 121 // processing should be stopped, or lowered in priority. |
| 121 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 122 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
| 122 | 123 |
| 123 // Requests a BeginFrame notification from the output surface. The | 124 // Requests a BeginFrame notification from the output surface. The |
| 124 // notification will be delivered by calling | 125 // notification will be delivered by calling |
| 125 // OutputSurfaceClient::BeginFrame until the callback is disabled. | 126 // OutputSurfaceClient::BeginFrame until the callback is disabled. |
| 126 virtual void SetNeedsBeginFrame(bool enable) {} | 127 virtual void SetNeedsBeginFrame(bool enable) {} |
| 127 | 128 |
| 128 bool HasClient() { return !!client_; } | 129 bool HasClient() const { return !!client_; } |
| 129 | 130 |
| 130 // Get the class capable of informing cc of hardware overlay capability. | 131 // Get the class capable of informing cc of hardware overlay capability. |
| 131 OverlayCandidateValidator* overlay_candidate_validator() const { | 132 OverlayCandidateValidator* overlay_candidate_validator() const { |
| 132 return overlay_candidate_validator_.get(); | 133 return overlay_candidate_validator_.get(); |
| 133 } | 134 } |
| 134 | 135 |
| 136 void BeginFrame(const BeginFrameArgs& args) const; |
| 137 |
| 138 base::WeakPtr<OutputSurface> GetWeakPtr() { |
| 139 return weak_ptr_factory_.GetWeakPtr(); |
| 140 } |
| 141 |
| 135 protected: | 142 protected: |
| 136 OutputSurfaceClient* client_; | 143 OutputSurfaceClient* client_; |
| 137 | 144 |
| 138 // Synchronously initialize context3d and enter hardware mode. | 145 // Synchronously initialize context3d and enter hardware mode. |
| 139 // This can only supported in threaded compositing mode. | 146 // This can only supported in threaded compositing mode. |
| 140 bool InitializeAndSetContext3d( | 147 bool InitializeAndSetContext3d( |
| 141 scoped_refptr<ContextProvider> context_provider); | 148 scoped_refptr<ContextProvider> context_provider); |
| 142 void ReleaseGL(); | 149 void ReleaseGL(); |
| 143 | 150 |
| 144 void PostSwapBuffersComplete(); | 151 void PostSwapBuffersComplete(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 173 bool external_stencil_test_enabled_; | 180 bool external_stencil_test_enabled_; |
| 174 | 181 |
| 175 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 182 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 176 | 183 |
| 177 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 184 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 178 }; | 185 }; |
| 179 | 186 |
| 180 } // namespace cc | 187 } // namespace cc |
| 181 | 188 |
| 182 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 189 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |