| 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_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 5 #ifndef CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| 6 #define CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 6 #define CC_TEST_PIXEL_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/scheduler/begin_frame_source.h" | 11 #include "cc/scheduler/begin_frame_source.h" |
| 11 #include "cc/surfaces/display.h" | 12 #include "cc/surfaces/display.h" |
| 12 #include "cc/surfaces/display_client.h" | 13 #include "cc/surfaces/display_client.h" |
| 13 #include "cc/surfaces/surface_factory.h" | 14 #include "cc/surfaces/surface_factory.h" |
| 14 #include "cc/surfaces/surface_factory_client.h" | 15 #include "cc/surfaces/surface_factory_client.h" |
| 15 #include "cc/surfaces/surface_id_allocator.h" | 16 #include "cc/surfaces/surface_id_allocator.h" |
| 16 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class PixelTestDelegatingOutputSurface : public OutputSurface, | 21 class PixelTestDelegatingOutputSurface : public OutputSurface, |
| 21 public SurfaceFactoryClient { | 22 public SurfaceFactoryClient { |
| 22 public: | 23 public: |
| 23 PixelTestDelegatingOutputSurface( | 24 PixelTestDelegatingOutputSurface( |
| 24 scoped_refptr<ContextProvider> compositor_context_provider, | 25 scoped_refptr<ContextProvider> compositor_context_provider, |
| 25 scoped_refptr<ContextProvider> worker_context_provider, | 26 scoped_refptr<ContextProvider> worker_context_provider, |
| 27 scoped_refptr<ContextProvider> display_context_provider, |
| 28 const RendererSettings& renderer_settings, |
| 26 SharedBitmapManager* shared_bitmap_manager, | 29 SharedBitmapManager* shared_bitmap_manager, |
| 27 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 31 const gfx::Size& surface_expansion_size, |
| 28 bool allow_force_reclaim_resources, | 32 bool allow_force_reclaim_resources, |
| 29 bool synchronous_composite); | 33 bool synchronous_composite); |
| 30 ~PixelTestDelegatingOutputSurface() override; | 34 ~PixelTestDelegatingOutputSurface() override; |
| 31 | 35 |
| 32 // OutputSurface implementation. | 36 // OutputSurface implementation. |
| 33 bool BindToClient(OutputSurfaceClient* client) override; | 37 bool BindToClient(OutputSurfaceClient* client) override; |
| 34 void DetachFromClient() override; | 38 void DetachFromClient() override; |
| 35 void SwapBuffers(CompositorFrame frame) override; | 39 void SwapBuffers(CompositorFrame frame) override; |
| 36 void ForceReclaimResources() override; | 40 void ForceReclaimResources() override; |
| 37 void BindFramebuffer() override; | 41 void BindFramebuffer() override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 49 private: | 53 private: |
| 50 void DrawCallback(SurfaceDrawStatus); | 54 void DrawCallback(SurfaceDrawStatus); |
| 51 | 55 |
| 52 class PixelTestDisplayClient : public DisplayClient { | 56 class PixelTestDisplayClient : public DisplayClient { |
| 53 void DisplayOutputSurfaceLost() override {} | 57 void DisplayOutputSurfaceLost() override {} |
| 54 void DisplaySetMemoryPolicy(const ManagedMemoryPolicy& policy) override {} | 58 void DisplaySetMemoryPolicy(const ManagedMemoryPolicy& policy) override {} |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 SharedBitmapManager* const shared_bitmap_manager_; | 61 SharedBitmapManager* const shared_bitmap_manager_; |
| 58 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; | 62 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; |
| 63 const gfx::Size surface_expansion_size_; |
| 59 const bool allow_force_reclaim_resources_; | 64 const bool allow_force_reclaim_resources_; |
| 60 const bool synchronous_composite_; | 65 const bool synchronous_composite_; |
| 66 const RendererSettings renderer_settings_; |
| 67 |
| 68 // Passed to the Display. |
| 69 scoped_refptr<ContextProvider> display_context_provider_; |
| 61 | 70 |
| 62 gfx::Size enlarge_pass_texture_amount_; | 71 gfx::Size enlarge_pass_texture_amount_; |
| 63 | 72 |
| 64 // TODO(danakj): These don't to be stored in unique_ptrs when OutputSurface | 73 // TODO(danakj): These don't to be stored in unique_ptrs when OutputSurface |
| 65 // is owned/destroyed on the compositor thread. | 74 // is owned/destroyed on the compositor thread. |
| 66 std::unique_ptr<SurfaceManager> surface_manager_; | 75 std::unique_ptr<SurfaceManager> surface_manager_; |
| 67 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_; | 76 std::unique_ptr<SurfaceIdAllocator> surface_id_allocator_; |
| 68 SurfaceId delegated_surface_id_; | 77 SurfaceId delegated_surface_id_; |
| 69 | 78 |
| 70 // Uses surface_manager_. | 79 // Uses surface_manager_. |
| 71 std::unique_ptr<SurfaceFactory> surface_factory_; | 80 std::unique_ptr<SurfaceFactory> surface_factory_; |
| 72 | 81 |
| 73 PixelTestDisplayClient display_client_; | 82 PixelTestDisplayClient display_client_; |
| 74 // Uses surface_manager_. | 83 // Uses surface_manager_. |
| 75 std::unique_ptr<Display> display_; | 84 std::unique_ptr<Display> display_; |
| 76 | 85 |
| 77 base::WeakPtrFactory<PixelTestDelegatingOutputSurface> weak_ptrs_; | 86 base::WeakPtrFactory<PixelTestDelegatingOutputSurface> weak_ptrs_; |
| 78 }; | 87 }; |
| 79 | 88 |
| 80 } // namespace cc | 89 } // namespace cc |
| 81 | 90 |
| 82 #endif // CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_ | 91 #endif // CC_TEST_PIXEL_TEST_DELEGATING_OUTPUT_SURFACE_H_ |
| OLD | NEW |