OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TEST_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ |
6 #define CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ | 6 #define CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "cc/output/compositor_frame_sink.h" | 10 #include "cc/output/compositor_frame_sink.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 public: | 47 public: |
48 // Pass true for |force_disable_reclaim_resources| to act like the Display | 48 // Pass true for |force_disable_reclaim_resources| to act like the Display |
49 // is out-of-process and can't return resources synchronously. | 49 // is out-of-process and can't return resources synchronously. |
50 TestCompositorFrameSink( | 50 TestCompositorFrameSink( |
51 scoped_refptr<ContextProvider> compositor_context_provider, | 51 scoped_refptr<ContextProvider> compositor_context_provider, |
52 scoped_refptr<ContextProvider> worker_context_provider, | 52 scoped_refptr<ContextProvider> worker_context_provider, |
53 SharedBitmapManager* shared_bitmap_manager, | 53 SharedBitmapManager* shared_bitmap_manager, |
54 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 54 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
55 const RendererSettings& renderer_settings, | 55 const RendererSettings& renderer_settings, |
56 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 56 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
57 bool synchronous_composite); | 57 bool synchronous_composite, |
| 58 bool force_disable_reclaim_resources); |
58 ~TestCompositorFrameSink() override; | 59 ~TestCompositorFrameSink() override; |
59 | 60 |
60 // This client must be set before BindToClient() happens. | 61 // This client must be set before BindToClient() happens. |
61 void SetClient(TestCompositorFrameSinkClient* client) { | 62 void SetClient(TestCompositorFrameSinkClient* client) { |
62 test_client_ = client; | 63 test_client_ = client; |
63 } | 64 } |
64 void SetEnlargePassTextureAmount(const gfx::Size& s) { | 65 void SetEnlargePassTextureAmount(const gfx::Size& s) { |
65 enlarge_pass_texture_amount_ = s; | 66 enlarge_pass_texture_amount_ = s; |
66 } | 67 } |
67 | 68 |
68 Display* display() const { return display_.get(); } | 69 Display* display() const { return display_.get(); } |
69 | 70 |
70 // Will be included with the next SubmitCompositorFrame. | 71 // Will be included with the next SubmitCompositorFrame. |
71 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request); | 72 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request); |
72 | 73 |
73 // CompositorFrameSink implementation. | 74 // CompositorFrameSink implementation. |
74 bool BindToClient(CompositorFrameSinkClient* client) override; | 75 bool BindToClient(CompositorFrameSinkClient* client) override; |
75 void DetachFromClient() override; | 76 void DetachFromClient() override; |
76 void SubmitCompositorFrame(CompositorFrame frame) override; | 77 void SubmitCompositorFrame(CompositorFrame frame) override; |
| 78 void ForceReclaimResources() override; |
77 | 79 |
78 // SurfaceFactoryClient implementation. | 80 // SurfaceFactoryClient implementation. |
79 void ReturnResources(const ReturnedResourceArray& resources) override; | 81 void ReturnResources(const ReturnedResourceArray& resources) override; |
80 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; | 82 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; |
81 | 83 |
82 // DisplayClient implementation. | 84 // DisplayClient implementation. |
83 void DisplayOutputSurfaceLost() override; | 85 void DisplayOutputSurfaceLost() override; |
84 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | 86 void DisplayWillDrawAndSwap(bool will_draw_and_swap, |
85 const RenderPassList& render_passes) override; | 87 const RenderPassList& render_passes) override; |
86 void DisplayDidDrawAndSwap() override; | 88 void DisplayDidDrawAndSwap() override; |
(...skipping 26 matching lines...) Expand all Loading... |
113 gfx::Size enlarge_pass_texture_amount_; | 115 gfx::Size enlarge_pass_texture_amount_; |
114 | 116 |
115 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; | 117 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; |
116 | 118 |
117 base::WeakPtrFactory<TestCompositorFrameSink> weak_ptr_factory_; | 119 base::WeakPtrFactory<TestCompositorFrameSink> weak_ptr_factory_; |
118 }; | 120 }; |
119 | 121 |
120 } // namespace cc | 122 } // namespace cc |
121 | 123 |
122 #endif // CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ | 124 #endif // CC_TEST_TEST_COMPOSITOR_FRAME_SINK_H_ |
OLD | NEW |