1 // Copyright (c) 2018 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 UI_OZONE_PUBLIC_PLATFORM_WINDOW_SURFACE_H_
6 #define UI_OZONE_PUBLIC_PLATFORM_WINDOW_SURFACE_H_
7 
8 #include "base/component_export.h"
9 #include "build/build_config.h"
10 
11 #if defined(OS_FUCHSIA)
12 #include <fuchsia/images/cpp/fidl.h>
13 #endif  // defined(OS_FUCHSIA)
14 
15 namespace ui {
16 
17 // Rendering and presentation API agnostic platform surface object.
18 //
19 // This object should be created prior to creation of a GLSurface,
20 // VulkanSurface, or software surface that presents to a PlatformWindow.
21 //
22 // It is basically the Viz service version of PlatformWindow, and is intended to
23 // contain the windowing system connection for a particular window's rendering
24 // surface.
25 //
26 // However, currently it is only used by SkiaRenderer on Fuchsia and does
27 // nothing in all other cases.
28 //
29 // TODO(spang): If we go this way, we should be consistent. You should have to
30 // have a PlatformWindowSurface before building a GLSurface or software surface
31 // as well.
COMPONENT_EXPORT(OZONE_BASE)32 class COMPONENT_EXPORT(OZONE_BASE) PlatformWindowSurface {
33  public:
34   virtual ~PlatformWindowSurface() {}
35 
36 #if defined(OS_FUCHSIA)
37   // Sets the texture of the surface to a new image pipe.
38   virtual bool SetTextureToNewImagePipe(
39       fidl::InterfaceRequest<fuchsia::images::ImagePipe2>
40           image_pipe_request) = 0;
41 #endif  // defined(OS_FUCHSIA)
42 
43   // Note: GL surface may be created through the GLOzone interface.
44   // However, you must still create a PlatformWindowSurface and keep it alive in
45   // order to present.
46 };
47 
48 }  // namespace ui
49 
50 #endif  // UI_OZONE_PUBLIC_PLATFORM_WINDOW_SURFACE_H_
51