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(new FakeOutputSurface( |
27 TestContextProvider::Create(), false)); | 27 TestContextProvider::Create(), TestContextProvider::Create(), false)); |
28 } | 28 } |
29 | 29 |
30 static scoped_ptr<FakeOutputSurface> Create3d( | 30 static scoped_ptr<FakeOutputSurface> Create3d( |
31 scoped_refptr<ContextProvider> context_provider) { | 31 scoped_refptr<ContextProvider> context_provider) { |
32 return make_scoped_ptr(new FakeOutputSurface(context_provider, false)); | 32 return make_scoped_ptr(new FakeOutputSurface(context_provider, false)); |
33 } | 33 } |
34 | 34 |
35 static scoped_ptr<FakeOutputSurface> Create3d( | 35 static scoped_ptr<FakeOutputSurface> Create3d( |
| 36 scoped_refptr<ContextProvider> context_provider, |
| 37 scoped_refptr<ContextProvider> worker_context_provider) { |
| 38 return make_scoped_ptr(new FakeOutputSurface( |
| 39 context_provider, worker_context_provider, false)); |
| 40 } |
| 41 |
| 42 static scoped_ptr<FakeOutputSurface> Create3d( |
36 scoped_ptr<TestWebGraphicsContext3D> context) { | 43 scoped_ptr<TestWebGraphicsContext3D> context) { |
37 return make_scoped_ptr(new FakeOutputSurface( | 44 return make_scoped_ptr(new FakeOutputSurface( |
38 TestContextProvider::Create(context.Pass()), false)); | 45 TestContextProvider::Create(context.Pass()), false)); |
39 } | 46 } |
40 | 47 |
41 static scoped_ptr<FakeOutputSurface> CreateSoftware( | 48 static scoped_ptr<FakeOutputSurface> CreateSoftware( |
42 scoped_ptr<SoftwareOutputDevice> software_device) { | 49 scoped_ptr<SoftwareOutputDevice> software_device) { |
43 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(), | 50 return make_scoped_ptr(new FakeOutputSurface(software_device.Pass(), |
44 false)); | 51 false)); |
45 } | 52 } |
46 | 53 |
47 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { | 54 static scoped_ptr<FakeOutputSurface> CreateDelegating3d() { |
48 return make_scoped_ptr(new FakeOutputSurface( | 55 return make_scoped_ptr(new FakeOutputSurface( |
49 TestContextProvider::Create(), true)); | 56 TestContextProvider::Create(), TestContextProvider::Create(), true)); |
50 } | 57 } |
51 | 58 |
52 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 59 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
53 scoped_refptr<TestContextProvider> context_provider) { | 60 scoped_refptr<TestContextProvider> context_provider) { |
54 return make_scoped_ptr(new FakeOutputSurface(context_provider, true)); | 61 return make_scoped_ptr(new FakeOutputSurface(context_provider, true)); |
55 } | 62 } |
56 | 63 |
57 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( | 64 static scoped_ptr<FakeOutputSurface> CreateDelegating3d( |
58 scoped_ptr<TestWebGraphicsContext3D> context) { | 65 scoped_ptr<TestWebGraphicsContext3D> context) { |
59 return make_scoped_ptr(new FakeOutputSurface( | 66 return make_scoped_ptr(new FakeOutputSurface( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 128 |
122 gfx::Rect last_swap_rect() const { | 129 gfx::Rect last_swap_rect() const { |
123 return last_swap_rect_; | 130 return last_swap_rect_; |
124 } | 131 } |
125 | 132 |
126 protected: | 133 protected: |
127 FakeOutputSurface( | 134 FakeOutputSurface( |
128 scoped_refptr<ContextProvider> context_provider, | 135 scoped_refptr<ContextProvider> context_provider, |
129 bool delegated_rendering); | 136 bool delegated_rendering); |
130 | 137 |
131 FakeOutputSurface( | 138 FakeOutputSurface(scoped_refptr<ContextProvider> context_provider, |
132 scoped_ptr<SoftwareOutputDevice> software_device, | 139 scoped_refptr<ContextProvider> worker_context_provider, |
133 bool delegated_rendering); | 140 bool delegated_rendering); |
| 141 |
| 142 FakeOutputSurface(scoped_ptr<SoftwareOutputDevice> software_device, |
| 143 bool delegated_rendering); |
134 | 144 |
135 FakeOutputSurface( | 145 FakeOutputSurface( |
136 scoped_refptr<ContextProvider> context_provider, | 146 scoped_refptr<ContextProvider> context_provider, |
137 scoped_ptr<SoftwareOutputDevice> software_device, | 147 scoped_ptr<SoftwareOutputDevice> software_device, |
138 bool delegated_rendering); | 148 bool delegated_rendering); |
139 | 149 |
140 OutputSurfaceClient* client_; | 150 OutputSurfaceClient* client_; |
141 CompositorFrame last_sent_frame_; | 151 CompositorFrame last_sent_frame_; |
142 size_t num_sent_frames_; | 152 size_t num_sent_frames_; |
143 bool has_external_stencil_test_; | 153 bool has_external_stencil_test_; |
144 unsigned framebuffer_; | 154 unsigned framebuffer_; |
145 TransferableResourceArray resources_held_by_parent_; | 155 TransferableResourceArray resources_held_by_parent_; |
146 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; | 156 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; |
147 gfx::Rect last_swap_rect_; | 157 gfx::Rect last_swap_rect_; |
148 }; | 158 }; |
149 | 159 |
150 } // namespace cc | 160 } // namespace cc |
151 | 161 |
152 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 162 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |