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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 virtual ~OutputSurface(); | 57 virtual ~OutputSurface(); |
58 | 58 |
59 struct Capabilities { | 59 struct Capabilities { |
60 Capabilities() | 60 Capabilities() |
61 : delegated_rendering(false), | 61 : delegated_rendering(false), |
62 max_frames_pending(0), | 62 max_frames_pending(0), |
63 deferred_gl_initialization(false), | 63 deferred_gl_initialization(false), |
64 draw_and_swap_full_viewport_every_frame(false), | 64 draw_and_swap_full_viewport_every_frame(false), |
65 adjust_deadline_for_parent(true), | 65 adjust_deadline_for_parent(true), |
66 uses_default_gl_framebuffer(true), | 66 uses_default_gl_framebuffer(true), |
67 flipped_output_surface(false) {} | 67 flipped_output_surface(false), |
| 68 can_force_reclaim_resources(false) {} |
68 bool delegated_rendering; | 69 bool delegated_rendering; |
69 int max_frames_pending; | 70 int max_frames_pending; |
70 bool deferred_gl_initialization; | 71 bool deferred_gl_initialization; |
71 bool draw_and_swap_full_viewport_every_frame; | 72 bool draw_and_swap_full_viewport_every_frame; |
72 // This doesn't handle the <webview> case, but once BeginFrame is | 73 // This doesn't handle the <webview> case, but once BeginFrame is |
73 // supported natively, we shouldn't need adjust_deadline_for_parent. | 74 // supported natively, we shouldn't need adjust_deadline_for_parent. |
74 bool adjust_deadline_for_parent; | 75 bool adjust_deadline_for_parent; |
75 // Whether this output surface renders to the default OpenGL zero | 76 // Whether this output surface renders to the default OpenGL zero |
76 // framebuffer or to an offscreen framebuffer. | 77 // framebuffer or to an offscreen framebuffer. |
77 bool uses_default_gl_framebuffer; | 78 bool uses_default_gl_framebuffer; |
78 // Whether this OutputSurface is flipped or not. | 79 // Whether this OutputSurface is flipped or not. |
79 bool flipped_output_surface; | 80 bool flipped_output_surface; |
| 81 // Whether ForceReclaimResources can be called to reclaim all resources |
| 82 // from the OutputSurface. |
| 83 bool can_force_reclaim_resources; |
80 }; | 84 }; |
81 | 85 |
82 const Capabilities& capabilities() const { | 86 const Capabilities& capabilities() const { |
83 return capabilities_; | 87 return capabilities_; |
84 } | 88 } |
85 | 89 |
86 virtual bool HasExternalStencilTest() const; | 90 virtual bool HasExternalStencilTest() const; |
87 | 91 |
88 // Obtain the 3d context or the software device associated with this output | 92 // Obtain the 3d context or the software device associated with this output |
89 // surface. Either of these may return a null pointer, but not both. | 93 // surface. Either of these may return a null pointer, but not both. |
(...skipping 14 matching lines...) Expand all Loading... |
104 // in order to release the ContextProvider. Only used with | 108 // in order to release the ContextProvider. Only used with |
105 // deferred_gl_initialization capability. | 109 // deferred_gl_initialization capability. |
106 void ReleaseContextProvider(); | 110 void ReleaseContextProvider(); |
107 | 111 |
108 virtual void EnsureBackbuffer(); | 112 virtual void EnsureBackbuffer(); |
109 virtual void DiscardBackbuffer(); | 113 virtual void DiscardBackbuffer(); |
110 | 114 |
111 virtual void Reshape(const gfx::Size& size, float scale_factor); | 115 virtual void Reshape(const gfx::Size& size, float scale_factor); |
112 virtual gfx::Size SurfaceSize() const; | 116 virtual gfx::Size SurfaceSize() const; |
113 | 117 |
| 118 // If supported, this causes a ReclaimResources for all resources that are |
| 119 // currently in use. |
| 120 virtual void ForceReclaimResources() {} |
| 121 |
114 virtual void BindFramebuffer(); | 122 virtual void BindFramebuffer(); |
115 | 123 |
116 // The implementation may destroy or steal the contents of the CompositorFrame | 124 // The implementation may destroy or steal the contents of the CompositorFrame |
117 // passed in (though it will not take ownership of the CompositorFrame | 125 // passed in (though it will not take ownership of the CompositorFrame |
118 // itself). For successful swaps, the implementation must call | 126 // itself). For successful swaps, the implementation must call |
119 // OutputSurfaceClient::DidSwapBuffers() and eventually | 127 // OutputSurfaceClient::DidSwapBuffers() and eventually |
120 // DidSwapBuffersComplete(). | 128 // DidSwapBuffersComplete(). |
121 virtual void SwapBuffers(CompositorFrame* frame) = 0; | 129 virtual void SwapBuffers(CompositorFrame* frame) = 0; |
122 virtual void OnSwapBuffersComplete(); | 130 virtual void OnSwapBuffersComplete(); |
123 | 131 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 bool external_stencil_test_enabled_; | 182 bool external_stencil_test_enabled_; |
175 | 183 |
176 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 184 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
177 | 185 |
178 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 186 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
179 }; | 187 }; |
180 | 188 |
181 } // namespace cc | 189 } // namespace cc |
182 | 190 |
183 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 191 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |