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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "cc/output/begin_frame_args.h" | 14 #include "cc/output/begin_frame_args.h" |
15 #include "cc/output/compositor_frame.h" | |
16 #include "cc/output/output_surface.h" | 15 #include "cc/output/output_surface.h" |
16 #include "cc/output/output_surface_frame.h" | |
17 #include "cc/output/software_output_device.h" | 17 #include "cc/output/software_output_device.h" |
18 #include "cc/test/test_context_provider.h" | 18 #include "cc/test/test_context_provider.h" |
19 #include "cc/test/test_gles2_interface.h" | 19 #include "cc/test/test_gles2_interface.h" |
20 #include "cc/test/test_web_graphics_context_3d.h" | 20 #include "cc/test/test_web_graphics_context_3d.h" |
21 | 21 |
22 namespace cc { | 22 namespace cc { |
23 | 23 |
24 class FakeOutputSurface : public OutputSurface { | 24 class FakeOutputSurface : public OutputSurface { |
25 public: | 25 public: |
26 ~FakeOutputSurface() override; | 26 ~FakeOutputSurface() override; |
(...skipping 30 matching lines...) Expand all Loading... | |
57 auto surface = base::WrapUnique( | 57 auto surface = base::WrapUnique( |
58 new FakeOutputSurface(TestContextProvider::Create(std::move(context)))); | 58 new FakeOutputSurface(TestContextProvider::Create(std::move(context)))); |
59 surface->capabilities_.uses_default_gl_framebuffer = false; | 59 surface->capabilities_.uses_default_gl_framebuffer = false; |
60 return surface; | 60 return surface; |
61 } | 61 } |
62 | 62 |
63 void set_max_frames_pending(int max) { | 63 void set_max_frames_pending(int max) { |
64 capabilities_.max_frames_pending = max; | 64 capabilities_.max_frames_pending = max; |
65 } | 65 } |
66 | 66 |
67 CompositorFrame* last_sent_frame() { return last_sent_frame_.get(); } | 67 OutputSurfaceFrame* last_sent_frame() { return last_sent_frame_.get(); } |
68 size_t num_sent_frames() { return num_sent_frames_; } | 68 size_t num_sent_frames() { return num_sent_frames_; } |
69 | 69 |
70 OutputSurfaceClient* client() { return client_; } | 70 OutputSurfaceClient* client() { return client_; } |
71 | 71 |
72 bool BindToClient(OutputSurfaceClient* client) override; | 72 bool BindToClient(OutputSurfaceClient* client) override; |
73 void EnsureBackbuffer() override {} | 73 void EnsureBackbuffer() override {} |
74 void DiscardBackbuffer() override {} | 74 void DiscardBackbuffer() override {} |
75 void BindFramebuffer() override; | 75 void BindFramebuffer() override; |
76 void SwapBuffers(CompositorFrame frame) override; | 76 void SwapBuffers(OutputSurfaceFrame frame) override; |
77 uint32_t GetFramebufferCopyTextureFormat() override; | 77 uint32_t GetFramebufferCopyTextureFormat() override; |
78 bool HasExternalStencilTest() const override; | 78 bool HasExternalStencilTest() const override; |
79 void ApplyExternalStencil() override {} | 79 void ApplyExternalStencil() override {} |
80 bool SurfaceIsSuspendForRecycle() const override; | 80 bool SurfaceIsSuspendForRecycle() const override; |
81 OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | 81 OverlayCandidateValidator* GetOverlayCandidateValidator() const override; |
82 bool IsDisplayedAsOverlayPlane() const override; | 82 bool IsDisplayedAsOverlayPlane() const override; |
83 unsigned GetOverlayTextureId() const override; | 83 unsigned GetOverlayTextureId() const override; |
84 | 84 |
85 void set_framebuffer(GLint framebuffer, GLenum format) { | 85 void set_framebuffer(GLint framebuffer, GLenum format) { |
86 framebuffer_ = framebuffer; | 86 framebuffer_ = framebuffer; |
(...skipping 10 matching lines...) Expand all Loading... | |
97 | 97 |
98 void set_suspended_for_recycle(bool suspended) { | 98 void set_suspended_for_recycle(bool suspended) { |
99 suspended_for_recycle_ = suspended; | 99 suspended_for_recycle_ = suspended; |
100 } | 100 } |
101 | 101 |
102 gfx::Rect last_swap_rect() const { | 102 gfx::Rect last_swap_rect() const { |
103 DCHECK(last_swap_rect_valid_); | 103 DCHECK(last_swap_rect_valid_); |
104 return last_swap_rect_; | 104 return last_swap_rect_; |
105 } | 105 } |
106 | 106 |
107 void ReturnResourcesHeldByParent(); | |
danakj
2016/10/04 21:58:40
Thanks for finding dead code :)
| |
108 | |
109 const TransferableResourceArray& resources_held_by_parent() { | |
110 return resources_held_by_parent_; | |
111 } | |
112 | |
113 protected: | 107 protected: |
114 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider); | 108 explicit FakeOutputSurface(scoped_refptr<ContextProvider> context_provider); |
115 explicit FakeOutputSurface( | 109 explicit FakeOutputSurface( |
116 std::unique_ptr<SoftwareOutputDevice> software_device); | 110 std::unique_ptr<SoftwareOutputDevice> software_device); |
117 | 111 |
118 OutputSurfaceClient* client_ = nullptr; | 112 OutputSurfaceClient* client_ = nullptr; |
119 std::unique_ptr<CompositorFrame> last_sent_frame_; | 113 std::unique_ptr<OutputSurfaceFrame> last_sent_frame_; |
120 size_t num_sent_frames_ = 0; | 114 size_t num_sent_frames_ = 0; |
121 bool has_external_stencil_test_ = false; | 115 bool has_external_stencil_test_ = false; |
122 bool suspended_for_recycle_ = false; | 116 bool suspended_for_recycle_ = false; |
123 GLint framebuffer_ = 0; | 117 GLint framebuffer_ = 0; |
124 GLenum framebuffer_format_ = 0; | 118 GLenum framebuffer_format_ = 0; |
125 TransferableResourceArray resources_held_by_parent_; | |
126 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; | 119 OverlayCandidateValidator* overlay_candidate_validator_ = nullptr; |
127 bool last_swap_rect_valid_ = false; | 120 bool last_swap_rect_valid_ = false; |
128 gfx::Rect last_swap_rect_; | 121 gfx::Rect last_swap_rect_; |
129 }; | 122 }; |
130 | 123 |
131 } // namespace cc | 124 } // namespace cc |
132 | 125 |
133 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ | 126 #endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_ |
OLD | NEW |