| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "cc/output/begin_frame_args.h" | 11 #include "cc/output/begin_frame_args.h" |
| 12 #include "cc/output/compositor_frame.h" | 12 #include "cc/output/compositor_frame.h" |
| 13 #include "cc/output/managed_memory_policy.h" | 13 #include "cc/output/managed_memory_policy.h" |
| 14 #include "cc/output/output_surface.h" | 14 #include "cc/output/output_surface.h" |
| 15 #include "cc/output/software_output_device.h" | 15 #include "cc/output/software_output_device.h" |
| 16 #include "cc/test/test_context_provider.h" | 16 #include "cc/test/test_context_provider.h" |
| 17 #include "cc/test/test_web_graphics_context_3d.h" | 17 #include "cc/test/test_web_graphics_context_3d.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class FakeOutputSurface : public OutputSurface { | 21 class FakeOutputSurface : public OutputSurface { |
| 22 public: | 22 public: |
| 23 ~FakeOutputSurface() override; | 23 ~FakeOutputSurface() override; |
| 24 | 24 |
| 25 static scoped_ptr<FakeOutputSurface> Create3d() { | 25 static scoped_ptr<FakeOutputSurface> Create3d() { |
| 26 return make_scoped_ptr( | 26 return make_scoped_ptr(new FakeOutputSurface( |
| 27 new FakeOutputSurface(TestContextProvider::Create(), | 27 TestContextProvider::Create(), TestContextProvider::Create(), false)); |
| 28 TestContextProvider::CreateWorker(), false)); | |
| 29 } | 28 } |
| 30 | 29 |
| 31 static scoped_ptr<FakeOutputSurface> Create3d( | 30 static scoped_ptr<FakeOutputSurface> Create3d( |
| 32 scoped_refptr<ContextProvider> context_provider) { | 31 scoped_refptr<ContextProvider> context_provider) { |
| 33 return make_scoped_ptr(new FakeOutputSurface( | 32 return make_scoped_ptr(new FakeOutputSurface( |
| 34 context_provider, TestContextProvider::CreateWorker(), false)); | 33 context_provider, TestContextProvider::Create(), false)); |
| 35 } | 34 } |
| 36 | 35 |
| 37 static scoped_ptr<FakeOutputSurface> Create3d( | 36 static scoped_ptr<FakeOutputSurface> Create3d( |
| 38 scoped_refptr<ContextProvider> context_provider, | 37 scoped_refptr<ContextProvider> context_provider, |
| 39 scoped_refptr<ContextProvider> worker_context_provider) { | 38 scoped_refptr<ContextProvider> worker_context_provider) { |
| 40 return make_scoped_ptr(new FakeOutputSurface( | 39 return make_scoped_ptr(new FakeOutputSurface( |
| 41 context_provider, worker_context_provider, false)); | 40 context_provider, worker_context_provider, false)); |
| 42 } | 41 } |
| 43 | 42 |
| 44 static scoped_ptr<FakeOutputSurface> Create3d( | 43 static scoped_ptr<FakeOutputSurface> Create3d( |
| 45 scoped_ptr<TestWebGraphicsContext3D> context) { | 44 scoped_ptr<TestWebGraphicsContext3D> context) { |
| 46 return make_scoped_ptr( | 45 return make_scoped_ptr( |
| 47 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), | 46 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), |
| 48 TestContextProvider::CreateWorker(), false)); | 47 TestContextProvider::Create(), false)); |
| 49 } | 48 } |
| 50 | 49 |
| 51 static scoped_ptr<FakeOutputSurface> CreateSoftware( | 50 static scoped_ptr<FakeOutputSurface> CreateSoftware( |
| 52 scoped_ptr<SoftwareOutputDevice> software_device) { | 51 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 53 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(), | 52 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(), |
| 54 false)); | 53 false)); |
| 55 } | 54 } |
| 56 | 55 |
| 57 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { | 56 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { |
| 58 return make_scoped_ptr( | 57 return make_scoped_ptr(new FakeOutputSurface( |
| 59 new FakeOutputSurface(TestContextProvider::Create(), | 58 TestContextProvider::Create(), TestContextProvider::Create(), true)); |
| 60 TestContextProvider::CreateWorker(), true)); | |
| 61 } | 59 } |
| 62 | 60 |
| 63 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 61 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
| 64 scoped_refptr<TestContextProvider> context_provider) { | 62 scoped_refptr<TestContextProvider> context_provider) { |
| 65 return make_scoped_ptr(new FakeOutputSurface( | 63 return make_scoped_ptr(new FakeOutputSurface( |
| 66 context_provider, TestContextProvider::CreateWorker(), true)); | 64 context_provider, TestContextProvider::Create(), true)); |
| 67 } | 65 } |
| 68 | 66 |
| 69 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 67 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
| 70 scoped_ptr<TestWebGraphicsContext3D> context) { | 68 scoped_ptr<TestWebGraphicsContext3D> context) { |
| 71 return make_scoped_ptr( | 69 return make_scoped_ptr( |
| 72 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), | 70 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), |
| 73 TestContextProvider::CreateWorker(), true)); | 71 TestContextProvider::Create(), true)); |
| 74 } | 72 } |
| 75 | 73 |
| 76 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( | 74 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( |
| 77 scoped_ptr<SoftwareOutputDevice> software_device) { | 75 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 78 return make_scoped_ptr( | 76 return make_scoped_ptr( |
| 79 new FakeOutputSurface(software_device.Pass(), true)); | 77 new FakeOutputSurface(software_device.Pass(), true)); |
| 80 } | 78 } |
| 81 | 79 |
| 82 static scoped_ptr<FakeOutputSurface> CreateAlwaysDrawAndSwap3d() { | 80 static scoped_ptr<FakeOutputSurface> CreateAlwaysDrawAndSwap3d() { |
| 83 scoped_ptr<FakeOutputSurface> surface(Create3d()); | 81 scoped_ptr<FakeOutputSurface> surface(Create3d()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 bool suspended_for_recycle_; | 160 bool suspended_for_recycle_; |
| 163 unsigned framebuffer_; | 161 unsigned framebuffer_; |
| 164 TransferableResourceArray resources_held_by_parent_; | 162 TransferableResourceArray resources_held_by_parent_; |
| 165 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; | 163 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; |
| 166 gfx::Rect last_swap_rect_; | 164 gfx::Rect last_swap_rect_; |
| 167 }; | 165 }; |
| 168 | 166 |
| 169 } // namespace cc | 167 } // namespace cc |
| 170 | 168 |
| 171 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 169 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |