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_TEST_FAKE_OUTPUT_SURFACE_H_ | 5 #ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 6 #define CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 capabilities_.max_frames_pending = max; | 102 capabilities_.max_frames_pending = max; |
103 } | 103 } |
104 | 104 |
105 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } | 105 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } |
106 size_t num_sent_frames() { return num_sent_frames_; } | 106 size_t num_sent_frames() { return num_sent_frames_; } |
107 | 107 |
108 void SwapBuffers(CompositorFrame frame) override; | 108 void SwapBuffers(CompositorFrame frame) override; |
109 | 109 |
110 OutputSurfaceClient* client() { return client_; } | 110 OutputSurfaceClient* client() { return client_; } |
111 bool BindToClient(OutputSurfaceClient* client) override; | 111 bool BindToClient(OutputSurfaceClient* client) override; |
| 112 void DetachFromClient() override; |
112 | 113 |
113 void set_framebuffer(GLint framebuffer, GLenum format) { | 114 void set_framebuffer(GLint framebuffer, GLenum format) { |
114 framebuffer_ = framebuffer; | 115 framebuffer_ = framebuffer; |
115 framebuffer_format_ = format; | 116 framebuffer_format_ = format; |
116 } | 117 } |
117 void BindFramebuffer() override; | 118 void BindFramebuffer() override; |
118 uint32_t GetFramebufferCopyTextureFormat() override; | 119 uint32_t GetFramebufferCopyTextureFormat() override; |
119 | 120 |
120 void SetTreeActivationCallback(const base::Closure& callback); | 121 void SetTreeActivationCallback(const base::Closure& callback); |
121 | 122 |
122 const TransferableResourceArray& resources_held_by_parent() { | 123 const TransferableResourceArray& resources_held_by_parent() { |
123 return resources_held_by_parent_; | 124 return resources_held_by_parent_; |
124 } | 125 } |
125 | 126 |
126 void ReturnResource(unsigned id, CompositorFrameAck* ack); | |
127 | |
128 bool HasExternalStencilTest() const override; | 127 bool HasExternalStencilTest() const override; |
129 | 128 |
130 bool SurfaceIsSuspendForRecycle() const override; | 129 bool SurfaceIsSuspendForRecycle() const override; |
131 | 130 |
132 OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | 131 OverlayCandidateValidator* GetOverlayCandidateValidator() const override; |
133 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) { | 132 void SetOverlayCandidateValidator(OverlayCandidateValidator* validator) { |
134 overlay_candidate_validator_ = validator; | 133 overlay_candidate_validator_ = validator; |
135 } | 134 } |
136 | 135 |
137 void set_has_external_stencil_test(bool has_test) { | 136 void set_has_external_stencil_test(bool has_test) { |
138 has_external_stencil_test_ = has_test; | 137 has_external_stencil_test_ = has_test; |
139 } | 138 } |
140 | 139 |
141 void set_suspended_for_recycle(bool suspended) { | 140 void set_suspended_for_recycle(bool suspended) { |
142 suspended_for_recycle_ = suspended; | 141 suspended_for_recycle_ = suspended; |
143 } | 142 } |
144 | 143 |
145 void SetMemoryPolicyToSetAtBind( | 144 void SetMemoryPolicyToSetAtBind( |
146 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); | 145 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); |
147 | 146 |
148 gfx::Rect last_swap_rect() const { | 147 gfx::Rect last_swap_rect() const { |
149 return last_swap_rect_; | 148 return last_swap_rect_; |
150 } | 149 } |
151 | 150 |
| 151 void ReturnResourcesHeldByParent(); |
| 152 |
152 protected: | 153 protected: |
153 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, | 154 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, |
154 scoped_refptr<ContextProvider> worker_context_provider, | 155 scoped_refptr<ContextProvider> worker_context_provider, |
155 bool delegated_rendering); | 156 bool delegated_rendering); |
156 | 157 |
157 FakeOutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device, | 158 FakeOutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device, |
158 bool delegated_rendering); | 159 bool delegated_rendering); |
159 | 160 |
160 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, | 161 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, |
161 scoped_refptr<ContextProvider> worker_context_provider, | 162 scoped_refptr<ContextProvider> worker_context_provider, |
162 std::unique_ptr<SoftwareOutputDevice> software_device, | 163 std::unique_ptr<SoftwareOutputDevice> software_device, |
163 bool delegated_rendering); | 164 bool delegated_rendering); |
164 | 165 |
165 OutputSurfaceClient* client_ = nullptr; | 166 OutputSurfaceClient* client_ = nullptr; |
166 std::unique_ptr<CompositorFrame> last_sent_frame_; | 167 std::unique_ptr<CompositorFrame> last_sent_frame_; |
167 size_t num_sent_frames_ = 0; | 168 size_t num_sent_frames_ = 0; |
168 bool has_external_stencil_test_ = false; | 169 bool has_external_stencil_test_ = false; |
169 bool suspended_for_recycle_ = false; | 170 bool suspended_for_recycle_ = false; |
170 GLint framebuffer_ = 0; | 171 GLint framebuffer_ = 0; |
171 GLenum framebuffer_format_ = 0; | 172 GLenum framebuffer_format_ = 0; |
172 TransferableResourceArray resources_held_by_parent_; | 173 TransferableResourceArray resources_held_by_parent_; |
173 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; | 174 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; |
174 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; | 175 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; |
175 gfx::Rect last_swap_rect_; | 176 gfx::Rect last_swap_rect_; |
176 }; | 177 }; |
177 | 178 |
178 } // namespace cc | 179 } // namespace cc |
179 | 180 |
180 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 181 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |