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 virtual ~FakeOutputSurface(); | 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(), 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 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 scoped_ptr<TestWebGraphicsContext3D> context) { | 85 scoped_ptr<TestWebGraphicsContext3D> context) { |
86 scoped_ptr<FakeOutputSurface> surface(new FakeOutputSurface( | 86 scoped_ptr<FakeOutputSurface> surface(new FakeOutputSurface( |
87 TestContextProvider::Create(context.Pass()), false)); | 87 TestContextProvider::Create(context.Pass()), false)); |
88 surface->capabilities_.uses_default_gl_framebuffer = false; | 88 surface->capabilities_.uses_default_gl_framebuffer = false; |
89 return surface.Pass(); | 89 return surface.Pass(); |
90 } | 90 } |
91 | 91 |
92 CompositorFrame& last_sent_frame() { return last_sent_frame_; } | 92 CompositorFrame& last_sent_frame() { return last_sent_frame_; } |
93 size_t num_sent_frames() { return num_sent_frames_; } | 93 size_t num_sent_frames() { return num_sent_frames_; } |
94 | 94 |
95 virtual void SwapBuffers(CompositorFrame* frame) override; | 95 void SwapBuffers(CompositorFrame* frame) override; |
96 | 96 |
97 virtual void SetNeedsBeginFrame(bool enable) override; | 97 void SetNeedsBeginFrame(bool enable) override; |
98 bool needs_begin_frame() const { return needs_begin_frame_; } | 98 bool needs_begin_frame() const { return needs_begin_frame_; } |
99 | 99 |
100 virtual bool BindToClient(OutputSurfaceClient* client) override; | 100 bool BindToClient(OutputSurfaceClient* client) override; |
101 | 101 |
102 using OutputSurface::ReleaseGL; | 102 using OutputSurface::ReleaseGL; |
103 using OutputSurface::InitializeAndSetContext3d; | 103 using OutputSurface::InitializeAndSetContext3d; |
104 | 104 |
105 void SetTreeActivationCallback(const base::Closure& callback); | 105 void SetTreeActivationCallback(const base::Closure& callback); |
106 | 106 |
107 const TransferableResourceArray& resources_held_by_parent() { | 107 const TransferableResourceArray& resources_held_by_parent() { |
108 return resources_held_by_parent_; | 108 return resources_held_by_parent_; |
109 } | 109 } |
110 | 110 |
111 void ReturnResource(unsigned id, CompositorFrameAck* ack); | 111 void ReturnResource(unsigned id, CompositorFrameAck* ack); |
112 | 112 |
113 virtual bool HasExternalStencilTest() const override; | 113 bool HasExternalStencilTest() const override; |
114 | 114 |
115 void set_has_external_stencil_test(bool has_test) { | 115 void set_has_external_stencil_test(bool has_test) { |
116 has_external_stencil_test_ = has_test; | 116 has_external_stencil_test_ = has_test; |
117 } | 117 } |
118 | 118 |
119 void SetMemoryPolicyToSetAtBind( | 119 void SetMemoryPolicyToSetAtBind( |
120 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); | 120 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind); |
121 | 121 |
122 gfx::Rect last_swap_rect() const { | 122 gfx::Rect last_swap_rect() const { |
123 return last_swap_rect_; | 123 return last_swap_rect_; |
(...skipping 23 matching lines...) Expand all Loading... |
147 TransferableResourceArray resources_held_by_parent_; | 147 TransferableResourceArray resources_held_by_parent_; |
148 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; | 148 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind_; |
149 gfx::Rect last_swap_rect_; | 149 gfx::Rect last_swap_rect_; |
150 | 150 |
151 base::WeakPtrFactory<FakeOutputSurface> fake_weak_ptr_factory_; | 151 base::WeakPtrFactory<FakeOutputSurface> fake_weak_ptr_factory_; |
152 }; | 152 }; |
153 | 153 |
154 } // namespace cc | 154 } // namespace cc |
155 | 155 |
156 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 156 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |