| 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 base::WeakPtr<TestDelegatingOutputSurface> GetWeakPtr() { |
| 41 return weak_ptrs_.GetWeakPtr(); |
| 42 } |
| 43 |
| 44 // Will be submitted with the next SwapBuffers. |
| 45 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> request); |
| 46 |
| 38 // OutputSurface implementation. | 47 // OutputSurface implementation. |
| 39 bool BindToClient(OutputSurfaceClient* client) override; | 48 bool BindToClient(OutputSurfaceClient* client) override; |
| 40 void DetachFromClient() override; | 49 void DetachFromClient() override; |
| 41 void SwapBuffers(CompositorFrame frame) override; | 50 void SwapBuffers(CompositorFrame frame) override; |
| 42 void ForceReclaimResources() override; | 51 void ForceReclaimResources() override; |
| 43 void BindFramebuffer() override; | 52 void BindFramebuffer() override; |
| 44 uint32_t GetFramebufferCopyTextureFormat() override; | 53 uint32_t GetFramebufferCopyTextureFormat() override; |
| 45 | 54 |
| 46 // SurfaceFactoryClient implementation. | 55 // SurfaceFactoryClient implementation. |
| 47 void ReturnResources(const ReturnedResourceArray& resources) override; | 56 void ReturnResources(const ReturnedResourceArray& resources) override; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 SurfaceId delegated_surface_id_; | 70 SurfaceId delegated_surface_id_; |
| 62 | 71 |
| 63 // Uses surface_manager_. | 72 // Uses surface_manager_. |
| 64 std::unique_ptr<SurfaceFactory> surface_factory_; | 73 std::unique_ptr<SurfaceFactory> surface_factory_; |
| 65 | 74 |
| 66 // Uses surface_manager_. | 75 // Uses surface_manager_. |
| 67 std::unique_ptr<Display> display_; | 76 std::unique_ptr<Display> display_; |
| 68 | 77 |
| 69 bool bound_ = false; | 78 bool bound_ = false; |
| 70 | 79 |
| 80 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; |
| 81 |
| 71 base::WeakPtrFactory<TestDelegatingOutputSurface> weak_ptrs_; | 82 base::WeakPtrFactory<TestDelegatingOutputSurface> weak_ptrs_; |
| 72 }; | 83 }; |
| 73 | 84 |
| 74 } // namespace cc | 85 } // namespace cc |
| 75 | 86 |
| 76 #endif // CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 87 #endif // CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| OLD | NEW |