| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_DELEGATING_OUTPUT_SURFACE_H_ | |
| 6 #define BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_DELEGATING_OUTPUT_SURFACE_H_ | |
| 7 | |
| 8 #include "cc/output/output_surface.h" | |
| 9 #include "cc/output/renderer_settings.h" | |
| 10 #include "cc/scheduler/begin_frame_source.h" | |
| 11 #include "cc/surfaces/display.h" | |
| 12 #include "cc/surfaces/display_client.h" | |
| 13 #include "cc/surfaces/surface_factory.h" | |
| 14 #include "cc/surfaces/surface_factory_client.h" | |
| 15 #include "cc/surfaces/surface_id_allocator.h" | |
| 16 #include "cc/surfaces/surface_manager.h" | |
| 17 | |
| 18 namespace blimp { | |
| 19 namespace client { | |
| 20 | |
| 21 // Delegating output surface that owns and forwards frames to a Display. | |
| 22 class BlimpDelegatingOutputSurface : public cc::OutputSurface, | |
| 23 public cc::SurfaceFactoryClient, | |
| 24 public cc::DisplayClient { | |
| 25 public: | |
| 26 BlimpDelegatingOutputSurface( | |
| 27 scoped_refptr<cc::ContextProvider> compositor_context_provider, | |
| 28 scoped_refptr<cc::ContextProvider> worker_context_provider, | |
| 29 std::unique_ptr<cc::OutputSurface> display_output_surface, | |
| 30 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 31 const cc::RendererSettings& renderer_settings, | |
| 32 base::SingleThreadTaskRunner* task_runner); | |
| 33 ~BlimpDelegatingOutputSurface() override; | |
| 34 | |
| 35 // OutputSurface implementation. | |
| 36 bool BindToClient(cc::OutputSurfaceClient* client) override; | |
| 37 void DetachFromClient() override; | |
| 38 void SwapBuffers(cc::CompositorFrame frame) override; | |
| 39 void ForceReclaimResources() override; | |
| 40 void BindFramebuffer() override; | |
| 41 uint32_t GetFramebufferCopyTextureFormat() override; | |
| 42 | |
| 43 // SurfaceFactoryClient implementation. | |
| 44 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 45 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
| 46 | |
| 47 // DisplayClient implementation. | |
| 48 void DisplayOutputSurfaceLost() override; | |
| 49 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | |
| 50 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | |
| 51 const cc::RenderPassList& render_passes) override; | |
| 52 void DisplayDidDrawAndSwap() override; | |
| 53 | |
| 54 private: | |
| 55 // TODO(danakj): These don't need to be stored in unique_ptrs when | |
| 56 // OutputSurface is owned/destroyed on the compositor thread. | |
| 57 std::unique_ptr<cc::SurfaceManager> surface_manager_; | |
| 58 std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | |
| 59 cc::SurfaceId delegated_surface_id_; | |
| 60 | |
| 61 // Uses surface_manager_. | |
| 62 std::unique_ptr<cc::SurfaceFactory> surface_factory_; | |
| 63 | |
| 64 // Uses surface_manager_. | |
| 65 std::unique_ptr<cc::Display> display_; | |
| 66 }; | |
| 67 | |
| 68 } // namespace client | |
| 69 } // namespace blimp | |
| 70 | |
| 71 #endif // BLIMP_CLIENT_FEATURE_COMPOSITOR_BLIMP_DELEGATING_OUTPUT_SURFACE_H_ | |
| OLD | NEW |