| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 CC_SURFACES_SURFACE_DISPLAY_OUTPUT_SURFACE_H_ | |
| 6 #define CC_SURFACES_SURFACE_DISPLAY_OUTPUT_SURFACE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/threading/thread_checker.h" | |
| 10 #include "cc/output/output_surface.h" | |
| 11 #include "cc/surfaces/display_client.h" | |
| 12 #include "cc/surfaces/surface_factory.h" | |
| 13 #include "cc/surfaces/surface_factory_client.h" | |
| 14 #include "cc/surfaces/surfaces_export.h" | |
| 15 | |
| 16 namespace cc { | |
| 17 class Display; | |
| 18 class SurfaceIdAllocator; | |
| 19 class SurfaceManager; | |
| 20 | |
| 21 // This class is maps a compositor OutputSurface to the surface system's Display | |
| 22 // concept, allowing a compositor client to submit frames for a native root | |
| 23 // window or physical display. | |
| 24 class CC_SURFACES_EXPORT SurfaceDisplayOutputSurface | |
| 25 : public OutputSurface, | |
| 26 public SurfaceFactoryClient, | |
| 27 public NON_EXPORTED_BASE(DisplayClient) { | |
| 28 public: | |
| 29 // The underlying Display and SurfaceManager must outlive this class. | |
| 30 SurfaceDisplayOutputSurface( | |
| 31 SurfaceManager* surface_manager, | |
| 32 SurfaceIdAllocator* allocator, | |
| 33 Display* display, | |
| 34 scoped_refptr<ContextProvider> context_provider, | |
| 35 scoped_refptr<ContextProvider> worker_context_provider); | |
| 36 SurfaceDisplayOutputSurface( | |
| 37 SurfaceManager* surface_manager, | |
| 38 SurfaceIdAllocator* allocator, | |
| 39 Display* display, | |
| 40 scoped_refptr<VulkanContextProvider> vulkan_context_provider); | |
| 41 ~SurfaceDisplayOutputSurface() override; | |
| 42 | |
| 43 // OutputSurface implementation. | |
| 44 void SwapBuffers(CompositorFrame frame) override; | |
| 45 bool BindToClient(OutputSurfaceClient* client) override; | |
| 46 void ForceReclaimResources() override; | |
| 47 void DetachFromClient() override; | |
| 48 void BindFramebuffer() override; | |
| 49 uint32_t GetFramebufferCopyTextureFormat() override; | |
| 50 | |
| 51 // SurfaceFactoryClient implementation. | |
| 52 void ReturnResources(const ReturnedResourceArray& resources) override; | |
| 53 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; | |
| 54 | |
| 55 // DisplayClient implementation. | |
| 56 void DisplayOutputSurfaceLost() override; | |
| 57 void DisplayWillDrawAndSwap(bool will_draw_and_swap, | |
| 58 const RenderPassList& render_passes) override; | |
| 59 void DisplayDidDrawAndSwap() override; | |
| 60 | |
| 61 private: | |
| 62 void DidDrawCallback(); | |
| 63 | |
| 64 // This class is only meant to be used on a single thread. | |
| 65 base::ThreadChecker thread_checker_; | |
| 66 | |
| 67 SurfaceManager* surface_manager_; | |
| 68 SurfaceIdAllocator* surface_id_allocator_; | |
| 69 Display* display_; | |
| 70 SurfaceFactory factory_; | |
| 71 SurfaceId delegated_surface_id_; | |
| 72 gfx::Size last_swap_frame_size_; | |
| 73 bool output_surface_lost_ = false; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(SurfaceDisplayOutputSurface); | |
| 76 }; | |
| 77 | |
| 78 } // namespace cc | |
| 79 | |
| 80 #endif // CC_SURFACES_SURFACE_DISPLAY_OUTPUT_SURFACE_H_ | |
| OLD | NEW |