summaryrefslogtreecommitdiffstats
path: root/ui/ozone/public/surface_ozone_egl.h
blob: 3056deca1f003acd66edbd968f7dd1bee1b6b2b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_
#define UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_

#include "base/basictypes.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
#include "ui/gfx/overlay_transform.h"
#include "ui/gfx/swap_result.h"
#include "ui/ozone/ozone_base_export.h"

namespace gfx {
class Size;
class VSyncProvider;
}

namespace ui {
class NativePixmap;

typedef base::Callback<void(gfx::SwapResult)> SwapCompletionCallback;

// The platform-specific part of an EGL surface.
//
// This class owns any bits that the ozone implementation needs freed when
// the EGL surface is destroyed.
class OZONE_BASE_EXPORT SurfaceOzoneEGL {
 public:
  virtual ~SurfaceOzoneEGL() {}

  // Returns the EGL native window for rendering onto this surface.
  // This can be used to to create a GLSurface.
  virtual intptr_t /* EGLNativeWindowType */ GetNativeWindow() = 0;

  // Attempts to resize the EGL native window to match the viewport
  // size.
  virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) = 0;

  // Called after we swap buffers. This is usually a no-op but can
  // be used to present the new front buffer if the platform requires this.
  virtual bool OnSwapBuffers() = 0;

  // Called after we swap buffers. This is usually a no-op but can
  // be used to present the new front buffer if the platform requires this.
  // The callback should be run on the calling thread
  // (i.e. same thread SwapBuffersAsync is called).
  virtual bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) = 0;

  // Returns a gfx::VsyncProvider for this surface. Note that this may be
  // called after we have entered the sandbox so if there are operations (e.g.
  // opening a file descriptor providing vsync events) that must be done
  // outside of the sandbox, they must have been completed in
  // InitializeHardware. Returns an empty scoped_ptr on error.
  virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0;

  // Returns true if the surface is created on a UDL device.
  virtual bool IsUniversalDisplayLinkDevice();
};

}  // namespace ui

#endif  // UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_