| Index: ui/gl/gl_surface_ozone.cc
|
| diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
|
| index 4ce8fde1bd410e2bf712c189187cf0add7563647..5bdb2c5c4572512c024c5bc61ac9a17c5d5e87ee 100644
|
| --- a/ui/gl/gl_surface_ozone.cc
|
| +++ b/ui/gl/gl_surface_ozone.cc
|
| @@ -8,6 +8,7 @@
|
| #include "base/memory/ref_counted.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| #include "ui/gfx/ozone/surface_factory_ozone.h"
|
| +#include "ui/gfx/ozone/surface_ozone.h"
|
| #include "ui/gl/gl_implementation.h"
|
| #include "ui/gl/gl_surface_egl.h"
|
| #include "ui/gl/gl_surface_osmesa.h"
|
| @@ -15,6 +16,28 @@
|
|
|
| namespace gfx {
|
|
|
| +namespace {
|
| +
|
| +// A thin wrapper around GLSurfaceEGL that owns the EGLNativeWindow
|
| +class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL {
|
| + public:
|
| + GLSurfaceOzoneEGL(scoped_ptr<SurfaceOzone> ozone_surface)
|
| + : NativeViewGLSurfaceEGL(ozone_surface->GetEGLNativeWindow()),
|
| + ozone_surface_(ozone_surface.Pass()) {}
|
| +
|
| + virtual ~GLSurfaceOzoneEGL() {
|
| + Destroy(); // EGL surface must be destroyed before SurfaceOzone
|
| + }
|
| +
|
| + private:
|
| + // The native surface. Deleting this is allowed to free the EGLNativeWindow.
|
| + scoped_ptr<SurfaceOzone> ozone_surface_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneEGL);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| // static
|
| bool GLSurface::InitializeOneOffInternal() {
|
| switch (GetGLImplementation()) {
|
| @@ -46,16 +69,15 @@ scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
|
| }
|
| DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2);
|
| if (window != kNullAcceleratedWidget) {
|
| - EGLNativeWindowType egl_window =
|
| - gfx::SurfaceFactoryOzone::GetInstance()->RealizeAcceleratedWidget(
|
| - window);
|
| - scoped_ptr<VSyncProvider> sync_provider =
|
| - gfx::SurfaceFactoryOzone::GetInstance()->CreateVSyncProvider(
|
| - egl_window);
|
| - scoped_refptr<NativeViewGLSurfaceEGL> surface =
|
| - new NativeViewGLSurfaceEGL(egl_window);
|
| - if (surface->Initialize(sync_provider.Pass()))
|
| - return surface;
|
| + scoped_ptr<SurfaceOzone> surface_ozone =
|
| + SurfaceFactoryOzone::GetInstance()->CreateSurfaceForWidget(window);
|
| + if (!surface_ozone->InitializeEGL())
|
| + return NULL;
|
| + scoped_refptr<GLSurfaceOzoneEGL> surface =
|
| + new GLSurfaceOzoneEGL(surface_ozone.Pass());
|
| + if (!surface->Initialize(surface_ozone->CreateVSyncProvider()))
|
| + return NULL;
|
| + return surface;
|
| } else {
|
| scoped_refptr<GLSurface> surface = new GLSurfaceStub();
|
| if (surface->Initialize())
|
|
|