1 // Copyright 2019 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 COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_
6 #define COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_
7 
8 #include <memory>
9 
10 #include "components/viz/service/display/display_compositor_memory_and_task_controller.h"
11 #include "gpu/ipc/common/surface_handle.h"
12 #include "gpu/ipc/gpu_task_scheduler_helper.h"
13 #include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
14 
15 namespace viz {
16 
17 struct DebugRendererSettings;
18 class DisplayCompositorMemoryAndTaskController;
19 class RendererSettings;
20 class OutputSurface;
21 
22 // Handles creating OutputSurface for FrameSinkManagerImpl.
23 class OutputSurfaceProvider {
24  public:
~OutputSurfaceProvider()25   virtual ~OutputSurfaceProvider() {}
26 
27   // Needs to be called before calling the CreateOutputSurface function. Output
28   // of this should feed into the CreateOutputSurface function.
29   virtual std::unique_ptr<DisplayCompositorMemoryAndTaskController>
30   CreateGpuDependency(bool gpu_compositing,
31                       gpu::SurfaceHandle surface_handle,
32                       const RendererSettings& renderer_settings) = 0;
33 
34   // Creates a new OutputSurface for |surface_handle|. If creating an
35   // OutputSurface fails this function will return null.
36   virtual std::unique_ptr<OutputSurface> CreateOutputSurface(
37       gpu::SurfaceHandle surface_handle,
38       bool gpu_compositing,
39       mojom::DisplayClient* display_client,
40       DisplayCompositorMemoryAndTaskController* gpu_dependency,
41       const RendererSettings& renderer_settings,
42       const DebugRendererSettings* debug_settings) = 0;
43 };
44 
45 }  // namespace viz
46 
47 #endif  //  COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_
48