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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 | 123 |
123 // Notifies frame-rate smoothness preference. If true, all non-critical | 124 // Notifies frame-rate smoothness preference. If true, all non-critical |
124 // processing should be stopped, or lowered in priority. | 125 // processing should be stopped, or lowered in priority. |
125 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} | 126 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) {} |
126 | 127 |
127 // Requests a BeginFrame notification from the output surface. The | 128 // Requests a BeginFrame notification from the output surface. The |
128 // notification will be delivered by calling | 129 // notification will be delivered by calling |
129 // OutputSurfaceClient::BeginFrame until the callback is disabled. | 130 // OutputSurfaceClient::BeginFrame until the callback is disabled. |
130 virtual void SetNeedsBeginFrame(bool enable) {} | 131 virtual void SetNeedsBeginFrame(bool enable) {} |
131 | 132 |
132 bool HasClient() { return !!client_; } | 133 bool HasClient() const { return !!client_; } |
133 | 134 |
134 // Get the class capable of informing cc of hardware overlay capability. | 135 // Get the class capable of informing cc of hardware overlay capability. |
135 OverlayCandidateValidator* overlay_candidate_validator() const { | 136 OverlayCandidateValidator* overlay_candidate_validator() const { |
136 return overlay_candidate_validator_.get(); | 137 return overlay_candidate_validator_.get(); |
137 } | 138 } |
138 | 139 |
140 void BeginFrame(const BeginFrameArgs& args) const; | |
brianderson
2014/09/04 18:45:45
Should this be OnBeginFrame and protected? Can you
| |
141 | |
142 base::WeakPtr<OutputSurface> GetWeakPtr() { | |
143 return weak_ptr_factory_.GetWeakPtr(); | |
144 } | |
145 | |
139 protected: | 146 protected: |
140 OutputSurfaceClient* client_; | 147 OutputSurfaceClient* client_; |
141 | 148 |
142 // Synchronously initialize context3d and enter hardware mode. | 149 // Synchronously initialize context3d and enter hardware mode. |
143 // This can only supported in threaded compositing mode. | 150 // This can only supported in threaded compositing mode. |
144 bool InitializeAndSetContext3d( | 151 bool InitializeAndSetContext3d( |
145 scoped_refptr<ContextProvider> context_provider); | 152 scoped_refptr<ContextProvider> context_provider); |
146 void ReleaseGL(); | 153 void ReleaseGL(); |
147 | 154 |
148 void PostSwapBuffersComplete(); | 155 void PostSwapBuffersComplete(); |
(...skipping 28 matching lines...) Expand all Loading... | |
177 bool external_stencil_test_enabled_; | 184 bool external_stencil_test_enabled_; |
178 | 185 |
179 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 186 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
180 | 187 |
181 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 188 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
182 }; | 189 }; |
183 | 190 |
184 } // namespace cc | 191 } // namespace cc |
185 | 192 |
186 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 193 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |