Home | History | Annotate | Download | only in public
      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 UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_
      6 #define UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/memory/scoped_ptr.h"
     10 #include "ui/ozone/ozone_base_export.h"
     11 
     12 namespace gfx {
     13 class Size;
     14 class VSyncProvider;
     15 }
     16 
     17 namespace ui {
     18 
     19 // The platform-specific part of an EGL surface.
     20 //
     21 // This class owns any bits that the ozone implementation needs freed when
     22 // the EGL surface is destroyed.
     23 class OZONE_BASE_EXPORT SurfaceOzoneEGL {
     24  public:
     25   virtual ~SurfaceOzoneEGL() {}
     26 
     27   // Returns the EGL native window for rendering onto this surface.
     28   // This can be used to to create a GLSurface.
     29   virtual intptr_t /* EGLNativeWindowType */ GetNativeWindow() = 0;
     30 
     31   // Attempts to resize the EGL native window to match the viewport
     32   // size.
     33   virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) = 0;
     34 
     35   // Called after we swap buffers. This is usually a no-op but can
     36   // be used to present the new front buffer if the platform requires this.
     37   virtual bool OnSwapBuffers() = 0;
     38 
     39   // Returns a gfx::VsyncProvider for this surface. Note that this may be
     40   // called after we have entered the sandbox so if there are operations (e.g.
     41   // opening a file descriptor providing vsync events) that must be done
     42   // outside of the sandbox, they must have been completed in
     43   // InitializeHardware. Returns an empty scoped_ptr on error.
     44   virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() = 0;
     45 };
     46 
     47 }  // namespace ui
     48 
     49 #endif  // UI_OZONE_PUBLIC_SURFACE_OZONE_EGL_H_
     50