| Index: ui/gl/gl_surface_ozone.cc
|
| diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
|
| index 67ab131b7a8c261905ca7fe5bc0a5aef855e2adb..374c71cff141d207d091070e6a7917fdf6ebaa57 100644
|
| --- a/ui/gl/gl_surface_ozone.cc
|
| +++ b/ui/gl/gl_surface_ozone.cc
|
| @@ -4,8 +4,10 @@
|
|
|
| #include "ui/gl/gl_surface.h"
|
|
|
| +#include "base/bind.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "ui/gfx/native_widget_types.h"
|
| #include "ui/gl/gl_context.h"
|
| #include "ui/gl/gl_image.h"
|
| @@ -99,13 +101,18 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL {
|
| DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneEGL);
|
| };
|
|
|
| -class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
|
| +class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL,
|
| + public base::SupportsWeakPtr<GLSurfaceOzoneSurfaceless> {
|
| public:
|
| GLSurfaceOzoneSurfaceless(scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface,
|
| AcceleratedWidget widget)
|
| : SurfacelessEGL(gfx::Size()),
|
| ozone_surface_(ozone_surface.Pass()),
|
| - widget_(widget) {}
|
| + widget_(widget) {
|
| + ozone_surface_->SetPageFlipCompletionCallback(
|
| + base::Bind(&GLSurfaceOzoneSurfaceless::PageFlipCompleted,
|
| + this->AsWeakPtr()));
|
| + }
|
|
|
| virtual bool Initialize() override {
|
| if (!SurfacelessEGL::Initialize())
|
| @@ -145,6 +152,16 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
|
| return true;
|
| }
|
|
|
| + void SetPageFlipCompletionCallback(
|
| + const PageFlipCompletionCallback& callback) override {
|
| + page_flip_completion_callback_ = callback;
|
| + }
|
| +
|
| + void PageFlipCompleted() {
|
| + DCHECK(!page_flip_completion_callback_.is_null());
|
| + page_flip_completion_callback_.Run();
|
| + }
|
| +
|
| private:
|
| virtual ~GLSurfaceOzoneSurfaceless() {
|
| Destroy(); // EGL surface must be destroyed before SurfaceOzone
|
| @@ -154,6 +171,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
|
| scoped_ptr<ui::SurfaceOzoneEGL> ozone_surface_;
|
| AcceleratedWidget widget_;
|
| scoped_ptr<VSyncProvider> vsync_provider_;
|
| + PageFlipCompletionCallback page_flip_completion_callback_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(GLSurfaceOzoneSurfaceless);
|
| };
|
|
|