| 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_DELEGATING_OUTPUT_SURFACE_H_ | 5 #ifndef CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| 6 #define CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 6 #define CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "cc/output/output_surface.h" | 9 #include "cc/output/output_surface.h" |
| 10 #include "cc/output/renderer_settings.h" | 10 #include "cc/output/renderer_settings.h" |
| 11 #include "cc/scheduler/begin_frame_source.h" | 11 #include "cc/scheduler/begin_frame_source.h" |
| 12 #include "cc/surfaces/display.h" | 12 #include "cc/surfaces/display.h" |
| 13 #include "cc/surfaces/display_client.h" | 13 #include "cc/surfaces/display_client.h" |
| 14 #include "cc/surfaces/surface_factory.h" | 14 #include "cc/surfaces/surface_factory.h" |
| 15 #include "cc/surfaces/surface_factory_client.h" | 15 #include "cc/surfaces/surface_factory_client.h" |
| 16 #include "cc/surfaces/surface_id_allocator.h" | 16 #include "cc/surfaces/surface_id_allocator.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class CopyOutputRequest; |
| 22 |
| 21 class TestDelegatingOutputSurface : public OutputSurface, | 23 class TestDelegatingOutputSurface : public OutputSurface, |
| 22 public SurfaceFactoryClient, | 24 public SurfaceFactoryClient, |
| 23 public DisplayClient { | 25 public DisplayClient { |
| 24 public: | 26 public: |
| 25 TestDelegatingOutputSurface( | 27 TestDelegatingOutputSurface( |
| 26 scoped_refptr<ContextProvider> compositor_context_provider, | 28 scoped_refptr<ContextProvider> compositor_context_provider, |
| 27 scoped_refptr<ContextProvider> worker_context_provider, | 29 scoped_refptr<ContextProvider> worker_context_provider, |
| 28 std::unique_ptr<OutputSurface> display_output_surface, | 30 std::unique_ptr<OutputSurface> display_output_surface, |
| 29 SharedBitmapManager* shared_bitmap_manager, | 31 SharedBitmapManager* shared_bitmap_manager, |
| 30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 31 const RendererSettings& renderer_settings, | 33 const RendererSettings& renderer_settings, |
| 32 base::SingleThreadTaskRunner* task_runner, | 34 base::SingleThreadTaskRunner* task_runner, |
| 33 bool synchronous_composite); | 35 bool synchronous_composite); |
| 34 ~TestDelegatingOutputSurface() override; | 36 ~TestDelegatingOutputSurface() override; |
| 35 | 37 |
| 36 Display* display() const { return display_.get(); } | 38 Display* display() const { return display_.get(); } |
| 37 | 39 |
| 40 // Will be submitted with the next SwapBuffers. |
| 41 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request); |
| 42 |
| 38 // OutputSurface implementation. | 43 // OutputSurface implementation. |
| 39 bool BindToClient(OutputSurfaceClient* client) override; | 44 bool BindToClient(OutputSurfaceClient* client) override; |
| 40 void DetachFromClient() override; | 45 void DetachFromClient() override; |
| 41 void SwapBuffers(CompositorFrame frame) override; | 46 void SwapBuffers(CompositorFrame frame) override; |
| 42 void ForceReclaimResources() override; | 47 void ForceReclaimResources() override; |
| 43 void BindFramebuffer() override; | 48 void BindFramebuffer() override; |
| 44 uint32_t GetFramebufferCopyTextureFormat() override; | 49 uint32_t GetFramebufferCopyTextureFormat() override; |
| 45 | 50 |
| 46 // SurfaceFactoryClient implementation. | 51 // SurfaceFactoryClient implementation. |
| 47 void ReturnResources(const ReturnedResourceArray& resources) override; | 52 void ReturnResources(const ReturnedResourceArray& resources) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 SurfaceId delegated_surface_id_; | 66 SurfaceId delegated_surface_id_; |
| 62 | 67 |
| 63 // Uses surface_manager_. | 68 // Uses surface_manager_. |
| 64 std::unique_ptr<SurfaceFactory> surface_factory_; | 69 std::unique_ptr<SurfaceFactory> surface_factory_; |
| 65 | 70 |
| 66 // Uses surface_manager_. | 71 // Uses surface_manager_. |
| 67 std::unique_ptr<Display> display_; | 72 std::unique_ptr<Display> display_; |
| 68 | 73 |
| 69 bool bound_ = false; | 74 bool bound_ = false; |
| 70 | 75 |
| 76 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; |
| 77 |
| 71 base::WeakPtrFactory<TestDelegatingOutputSurface> weak_ptrs_; | 78 base::WeakPtrFactory<TestDelegatingOutputSurface> weak_ptrs_; |
| 72 }; | 79 }; |
| 73 | 80 |
| 74 } // namespace cc | 81 } // namespace cc |
| 75 | 82 |
| 76 #endif // CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 83 #endif // CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| OLD | NEW |