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 "gpu/ipc/common/surface_handle.h"
11 #include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
12 
13 namespace gpu {
14 class SharedImageManager;
15 }
16 
17 namespace viz {
18 
19 class RendererSettings;
20 class OutputSurface;
21 
22 // Handles creating OutputSurface for FrameSinkManagerImpl.
23 class OutputSurfaceProvider {
24  public:
~OutputSurfaceProvider()25   virtual ~OutputSurfaceProvider() {}
26 
27   // Creates a new OutputSurface for |surface_handle|. If creating an
28   // OutputSurface fails this function will return null.
29   virtual std::unique_ptr<OutputSurface> CreateOutputSurface(
30       gpu::SurfaceHandle surface_handle,
31       bool gpu_compositing,
32       mojom::DisplayClient* display_client,
33       const RendererSettings& renderer_settings) = 0;
34 
35   // TODO(weiliangc): This API is unfortunately located since this is the
36   // overlapping place that both GLOutputSurface and SkiaOutputSurface code path
37   // has access to SharedImageManager. Refactor so that OverlayProcessor and
38   // OutputSurface could be initialized together at appropriate place.
39   virtual gpu::SharedImageManager* GetSharedImageManager() = 0;
40 };
41 
42 }  // namespace viz
43 
44 #endif  //  COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_OUTPUT_SURFACE_PROVIDER_H_
45