| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class TestDelegatingOutputSurfaceClient { | 22 class TestDelegatingOutputSurfaceClient { |
| 23 public: | 23 public: |
| 24 virtual ~TestDelegatingOutputSurfaceClient() {} | 24 virtual ~TestDelegatingOutputSurfaceClient() {} |
| 25 | 25 |
| 26 virtual void DisplayReceivedCompositorFrame(const CompositorFrame& frame) = 0; | 26 virtual void DisplayReceivedCompositorFrame(const CompositorFrame& frame) = 0; |
| 27 virtual void DisplayWillDrawAndSwap(bool will_draw_and_swap, | 27 virtual void DisplayWillDrawAndSwap(bool will_draw_and_swap, |
| 28 const RenderPassList& render_passes) = 0; | 28 const RenderPassList& render_passes) = 0; |
| 29 virtual void DisplayDidDrawAndSwap() = 0; | 29 virtual void DisplayDidDrawAndSwap() = 0; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Delegating output surface that owns and forwards frames to a Display. |
| 32 class TestDelegatingOutputSurface : public OutputSurface, | 33 class TestDelegatingOutputSurface : public OutputSurface, |
| 33 public SurfaceFactoryClient, | 34 public SurfaceFactoryClient, |
| 34 public DisplayClient { | 35 public DisplayClient { |
| 35 public: | 36 public: |
| 36 // Pass true for |force_disable_reclaim_resources| to act like the Display | 37 // Pass true for |force_disable_reclaim_resources| to act like the Display |
| 37 // is out-of-process and can't return resources synchronously. | 38 // is out-of-process and can't return resources synchronously. |
| 38 TestDelegatingOutputSurface( | 39 TestDelegatingOutputSurface( |
| 39 scoped_refptr<ContextProvider> compositor_context_provider, | 40 scoped_refptr<ContextProvider> compositor_context_provider, |
| 40 scoped_refptr<ContextProvider> worker_context_provider, | 41 scoped_refptr<ContextProvider> worker_context_provider, |
| 41 std::unique_ptr<OutputSurface> display_output_surface, | 42 std::unique_ptr<OutputSurface> display_output_surface, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 71 // DisplayClient implementation. | 72 // DisplayClient implementation. |
| 72 void DisplayOutputSurfaceLost() override; | 73 void DisplayOutputSurfaceLost() override; |
| 73 void DisplaySetMemoryPolicy(const ManagedMemoryPolicy& policy) override; | 74 void DisplaySetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
| 74 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | 75 void DisplayWillDrawAndSwap(bool will_draw_and_swap, |
| 75 const RenderPassList& render_passes) override; | 76 const RenderPassList& render_passes) override; |
| 76 void DisplayDidDrawAndSwap() override; | 77 void DisplayDidDrawAndSwap() override; |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 void DidDrawCallback(bool synchronous); | 80 void DidDrawCallback(bool synchronous); |
| 80 | 81 |
| 81 // TODO(danakj): These don't to be stored in unique_ptrs when OutputSurface | 82 // TODO(danakj): These don't need to be stored in unique_ptrs when |
| 82 // is owned/destroyed on the compositor thread. | 83 // OutputSurface is owned/destroyed on the compositor thread. |
| 83 std::unique_ptr<SurfaceManager> surface_manager_; | 84 std::unique_ptr<SurfaceManager> surface_manager_; |
| 84 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_; | 85 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_; |
| 85 SurfaceId delegated_surface_id_; | 86 SurfaceId delegated_surface_id_; |
| 86 | 87 |
| 87 // Uses surface_manager_. | 88 // Uses surface_manager_. |
| 88 std::unique_ptr<SurfaceFactory> surface_factory_; | 89 std::unique_ptr<SurfaceFactory> surface_factory_; |
| 89 | 90 |
| 90 // Uses surface_manager_. | 91 // Uses surface_manager_. |
| 91 std::unique_ptr<Display> display_; | 92 std::unique_ptr<Display> display_; |
| 92 | 93 |
| 93 bool bound_ = false; | 94 bool bound_ = false; |
| 94 TestDelegatingOutputSurfaceClient* test_client_ = nullptr; | 95 TestDelegatingOutputSurfaceClient* test_client_ = nullptr; |
| 95 | 96 |
| 96 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; | 97 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; |
| 97 | 98 |
| 98 base::WeakPtrFactory<TestDelegatingOutputSurface> weak_ptrs_; | 99 base::WeakPtrFactory<TestDelegatingOutputSurface> weak_ptrs_; |
| 99 }; | 100 }; |
| 100 | 101 |
| 101 } // namespace cc | 102 } // namespace cc |
| 102 | 103 |
| 103 #endif // CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 104 #endif // CC_TEST_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| OLD | NEW |