| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 static std::unique_ptr<FakeOutputSurface> CreateSoftware( | 54 static std::unique_ptr<FakeOutputSurface> CreateSoftware( |
| 55 std::unique_ptr<SoftwareOutputDevice> software_device) { | 55 std::unique_ptr<SoftwareOutputDevice> software_device) { |
| 56 return base::WrapUnique( | 56 return base::WrapUnique( |
| 57 new FakeOutputSurface(std::move(software_device), false)); | 57 new FakeOutputSurface(std::move(software_device), false)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 static std::unique_ptr<FakeOutputSurface> | 60 static std::unique_ptr<FakeOutputSurface> |
| 61 Create3dWithResourcelessSoftwareSupport() { | 61 Create3dWithResourcelessSoftwareSupport() { |
| 62 return base::WrapUnique(new FakeOutputSurface( | 62 return base::WrapUnique(new FakeOutputSurface( |
| 63 TestContextProvider::Create(), | 63 TestContextProvider::Create(), TestContextProvider::CreateWorker(), |
| 64 base::WrapUnique(new SoftwareOutputDevice), false)); | 64 base::WrapUnique(new SoftwareOutputDevice), false)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d() { | 67 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d() { |
| 68 return base::WrapUnique( | 68 return base::WrapUnique( |
| 69 new FakeOutputSurface(TestContextProvider::Create(), | 69 new FakeOutputSurface(TestContextProvider::Create(), |
| 70 TestContextProvider::CreateWorker(), true)); | 70 TestContextProvider::CreateWorker(), true)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d( | 73 static std::unique_ptr<FakeOutputSurface> CreateDelegating3d( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 static std::unique_ptr<FakeOutputSurface> CreateNoRequireSyncPoint( | 92 static std::unique_ptr<FakeOutputSurface> CreateNoRequireSyncPoint( |
| 93 std::unique_ptr<TestWebGraphicsContext3D> context) { | 93 std::unique_ptr<TestWebGraphicsContext3D> context) { |
| 94 std::unique_ptr<FakeOutputSurface> surface(Create3d(std::move(context))); | 94 std::unique_ptr<FakeOutputSurface> surface(Create3d(std::move(context))); |
| 95 surface->capabilities_.delegated_sync_points_required = false; | 95 surface->capabilities_.delegated_sync_points_required = false; |
| 96 return surface; | 96 return surface; |
| 97 } | 97 } |
| 98 | 98 |
| 99 static std::unique_ptr<FakeOutputSurface> CreateOffscreen( | 99 static std::unique_ptr<FakeOutputSurface> CreateOffscreen( |
| 100 std::unique_ptr<TestWebGraphicsContext3D> context) { | 100 std::unique_ptr<TestWebGraphicsContext3D> context) { |
| 101 std::unique_ptr<FakeOutputSurface> surface(new FakeOutputSurface( | 101 std::unique_ptr<FakeOutputSurface> surface( |
| 102 TestContextProvider::Create(std::move(context)), false)); | 102 new FakeOutputSurface(TestContextProvider::Create(std::move(context)), |
| 103 TestContextProvider::CreateWorker(), false)); |
| 103 surface->capabilities_.uses_default_gl_framebuffer = false; | 104 surface->capabilities_.uses_default_gl_framebuffer = false; |
| 104 return surface; | 105 return surface; |
| 105 } | 106 } |
| 106 | 107 |
| 107 void set_max_frames_pending(int max) { | 108 void set_max_frames_pending(int max) { |
| 108 capabilities_.max_frames_pending = max; | 109 capabilities_.max_frames_pending = max; |
| 109 } | 110 } |
| 110 | 111 |
| 111 CompositorFrame& last_sent_frame() { return last_sent_frame_; } | 112 CompositorFrame& last_sent_frame() { return last_sent_frame_; } |
| 112 size_t num_sent_frames() { return num_sent_frames_; } | 113 size_t num_sent_frames() { return num_sent_frames_; } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 146 } |
| 146 | 147 |
| 147 void SetMemoryPolicyToSetAtBind( | 148 void SetMemoryPolicyToSetAtBind( |
| 148 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); | 149 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); |
| 149 | 150 |
| 150 gfx::Rect last_swap_rect() const { | 151 gfx::Rect last_swap_rect() const { |
| 151 return last_swap_rect_; | 152 return last_swap_rect_; |
| 152 } | 153 } |
| 153 | 154 |
| 154 protected: | 155 protected: |
| 155 FakeOutputSurface( | |
| 156 scoped_refptr<ContextProvider> context_provider, | |
| 157 bool delegated_rendering); | |
| 158 | |
| 159 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, | 156 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, |
| 160 scoped_refptr<ContextProvider> worker_context_provider, | 157 scoped_refptr<ContextProvider> worker_context_provider, |
| 161 bool delegated_rendering); | 158 bool delegated_rendering); |
| 162 | 159 |
| 163 FakeOutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device, | 160 FakeOutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device, |
| 164 bool delegated_rendering); | 161 bool delegated_rendering); |
| 165 | 162 |
| 166 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, | 163 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, |
| 164 scoped_refptr<ContextProvider> worker_context_provider, |
| 167 std::unique_ptr<SoftwareOutputDevice> software_device, | 165 std::unique_ptr<SoftwareOutputDevice> software_device, |
| 168 bool delegated_rendering); | 166 bool delegated_rendering); |
| 169 | 167 |
| 170 OutputSurfaceClient* client_; | 168 OutputSurfaceClient* client_; |
| 171 CompositorFrame last_sent_frame_; | 169 CompositorFrame last_sent_frame_; |
| 172 size_t num_sent_frames_; | 170 size_t num_sent_frames_; |
| 173 bool has_external_stencil_test_; | 171 bool has_external_stencil_test_; |
| 174 bool suspended_for_recycle_; | 172 bool suspended_for_recycle_; |
| 175 unsigned framebuffer_; | 173 unsigned framebuffer_; |
| 176 TransferableResourceArray resources_held_by_parent_; | 174 TransferableResourceArray resources_held_by_parent_; |
| 177 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; | 175 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; |
| 178 OverlayCandidateValidator* overlay_candidate_validator_; | 176 OverlayCandidateValidator* overlay_candidate_validator_; |
| 179 gfx::Rect last_swap_rect_; | 177 gfx::Rect last_swap_rect_; |
| 180 }; | 178 }; |
| 181 | 179 |
| 182 } // namespace cc | 180 } // namespace cc |
| 183 | 181 |
| 184 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 182 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |