| 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(new FakeOutputSurface( | 26 return make_scoped_ptr( |
| 27 TestContextProvider::Create(), TestContextProvider::Create(), false)); | 27 new FakeOutputSurface(TestContextProvider::Create(), |
| 28 TestContextProvider::CreateWorker(), false)); |
| 28 } | 29 } |
| 29 | 30 |
| 30 static scoped_ptr<FakeOutputSurface> Create3d( | 31 static scoped_ptr<FakeOutputSurface> Create3d( |
| 31 scoped_refptr<ContextProvider> context_provider) { | 32 scoped_refptr<ContextProvider> context_provider) { |
| 32 return make_scoped_ptr(new FakeOutputSurface( | 33 return make_scoped_ptr(new FakeOutputSurface( |
| 33 context_provider, TestContextProvider::Create(), false)); | 34 context_provider, TestContextProvider::CreateWorker(), false)); |
| 34 } | 35 } |
| 35 | 36 |
| 36 static scoped_ptr<FakeOutputSurface> Create3d( | 37 static scoped_ptr<FakeOutputSurface> Create3d( |
| 37 scoped_refptr<ContextProvider> context_provider, | 38 scoped_refptr<ContextProvider> context_provider, |
| 38 scoped_refptr<ContextProvider> worker_context_provider) { | 39 scoped_refptr<ContextProvider> worker_context_provider) { |
| 39 return make_scoped_ptr(new FakeOutputSurface( | 40 return make_scoped_ptr(new FakeOutputSurface( |
| 40 context_provider, worker_context_provider, false)); | 41 context_provider, worker_context_provider, false)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 static scoped_ptr<FakeOutputSurface> Create3d( | 44 static scoped_ptr<FakeOutputSurface> Create3d( |
| 44 scoped_ptr<TestWebGraphicsContext3D> context) { | 45 scoped_ptr<TestWebGraphicsContext3D> context) { |
| 45 return make_scoped_ptr( | 46 return make_scoped_ptr( |
| 46 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), | 47 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), |
| 47 TestContextProvider::Create(), false)); | 48 TestContextProvider::CreateWorker(), false)); |
| 48 } | 49 } |
| 49 | 50 |
| 50 static scoped_ptr<FakeOutputSurface> CreateSoftware( | 51 static scoped_ptr<FakeOutputSurface> CreateSoftware( |
| 51 scoped_ptr<SoftwareOutputDevice> software_device) { | 52 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 52 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(), | 53 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(), |
| 53 false)); | 54 false)); |
| 54 } | 55 } |
| 55 | 56 |
| 56 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { | 57 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { |
| 57 return make_scoped_ptr(new FakeOutputSurface( | 58 return make_scoped_ptr( |
| 58 TestContextProvider::Create(), TestContextProvider::Create(), true)); | 59 new FakeOutputSurface(TestContextProvider::Create(), |
| 60 TestContextProvider::CreateWorker(), true)); |
| 59 } | 61 } |
| 60 | 62 |
| 61 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 63 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
| 62 scoped_refptr<TestContextProvider> context_provider) { | 64 scoped_refptr<TestContextProvider> context_provider) { |
| 63 return make_scoped_ptr(new FakeOutputSurface( | 65 return make_scoped_ptr(new FakeOutputSurface( |
| 64 context_provider, TestContextProvider::Create(), true)); | 66 context_provider, TestContextProvider::CreateWorker(), true)); |
| 65 } | 67 } |
| 66 | 68 |
| 67 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 69 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
| 68 scoped_ptr<TestWebGraphicsContext3D> context) { | 70 scoped_ptr<TestWebGraphicsContext3D> context) { |
| 69 return make_scoped_ptr( | 71 return make_scoped_ptr( |
| 70 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), | 72 new FakeOutputSurface(TestContextProvider::Create(context.Pass()), |
| 71 TestContextProvider::Create(), true)); | 73 TestContextProvider::CreateWorker(), true)); |
| 72 } | 74 } |
| 73 | 75 |
| 74 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( | 76 static scoped_ptr<FakeOutputSurface> CreateDelegatingSoftware( |
| 75 scoped_ptr<SoftwareOutputDevice> software_device) { | 77 scoped_ptr<SoftwareOutputDevice> software_device) { |
| 76 return make_scoped_ptr( | 78 return make_scoped_ptr( |
| 77 new FakeOutputSurface(software_device.Pass(), true)); | 79 new FakeOutputSurface(software_device.Pass(), true)); |
| 78 } | 80 } |
| 79 | 81 |
| 80 static scoped_ptr<FakeOutputSurface> CreateAlwaysDrawAndSwap3d() { | 82 static scoped_ptr<FakeOutputSurface> CreateAlwaysDrawAndSwap3d() { |
| 81 scoped_ptr<FakeOutputSurface> surface(Create3d()); | 83 scoped_ptr<FakeOutputSurface> surface(Create3d()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 bool suspended_for_recycle_; | 162 bool suspended_for_recycle_; |
| 161 unsigned framebuffer_; | 163 unsigned framebuffer_; |
| 162 TransferableResourceArray resources_held_by_parent_; | 164 TransferableResourceArray resources_held_by_parent_; |
| 163 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; | 165 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; |
| 164 gfx::Rect last_swap_rect_; | 166 gfx::Rect last_swap_rect_; |
| 165 }; | 167 }; |
| 166 | 168 |
| 167 } // namespace cc | 169 } // namespace cc |
| 168 | 170 |
| 169 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 171 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
| OLD | NEW |