Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: ui/gl/gl_surface_ozone.cc

Issue 1084173004: Adding status to swap complete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change swapbuffers return Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gl/gl_surface_ozone.cc
diff --git a/ui/gl/gl_surface_ozone.cc b/ui/gl/gl_surface_ozone.cc
index 7dac123f0d1527cb61fdbaf8986ef12fa4f3ce48..fa5086b64ce22d54eb3af4501063fcbad57f01a5 100644
--- a/ui/gl/gl_surface_ozone.cc
+++ b/ui/gl/gl_surface_ozone.cc
@@ -56,11 +56,11 @@ class GL_EXPORT GLSurfaceOzoneEGL : public NativeViewGLSurfaceEGL {
return NativeViewGLSurfaceEGL::Resize(size);
}
- bool SwapBuffers() override {
+ gfx::SwapResult SwapBuffers() override {
if (!NativeViewGLSurfaceEGL::SwapBuffers())
- return false;
+ return gfx::SWAP_FAILED;
- return ozone_surface_->OnSwapBuffers();
+ return ozone_surface_->OnSwapBuffers() ? gfx::SWAP_ACK : gfx::SWAP_FAILED;
}
bool ScheduleOverlayPlane(int z_order,
OverlayTransform transform,
@@ -142,14 +142,14 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
return SurfacelessEGL::Resize(size);
}
- bool SwapBuffers() override {
+ gfx::SwapResult SwapBuffers() override {
glFlush();
// TODO: the following should be replaced by a per surface flush as it gets
// implemented in GL drivers.
if (has_implicit_external_sync_) {
EGLSyncKHR fence = InsertFence();
if (!fence)
- return false;
+ return gfx::SWAP_FAILED;
EGLDisplay display = GetDisplay();
WaitForFence(display, fence);
@@ -161,7 +161,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
unsubmitted_frames_.back()->ScheduleOverlayPlanes(widget_);
unsubmitted_frames_.back()->overlays.clear();
- return ozone_surface_->OnSwapBuffers();
+ return ozone_surface_->OnSwapBuffers() ? gfx::SWAP_ACK : gfx::SWAP_FAILED;
}
bool ScheduleOverlayPlane(int z_order,
OverlayTransform transform,
@@ -175,10 +175,9 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
bool IsOffscreen() override { return false; }
VSyncProvider* GetVSyncProvider() override { return vsync_provider_.get(); }
bool SupportsPostSubBuffer() override { return true; }
- bool PostSubBuffer(int x, int y, int width, int height) override {
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override {
// The actual sub buffer handling is handled at higher layers.
- SwapBuffers();
- return true;
+ return SwapBuffers();
}
bool SwapBuffersAsync(const SwapCompletionCallback& callback) override {
// If last swap failed, don't try to schedule new ones.
@@ -187,7 +186,7 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
glFlush();
- base::Closure surface_swap_callback =
+ SwapCompletionCallback surface_swap_callback =
base::Bind(&GLSurfaceOzoneSurfaceless::SwapCompleted,
weak_factory_.GetWeakPtr(), callback);
@@ -298,8 +297,9 @@ class GL_EXPORT GLSurfaceOzoneSurfaceless : public SurfacelessEGL {
SubmitFrame();
}
- void SwapCompleted(const SwapCompletionCallback& callback) {
- callback.Run();
+ void SwapCompleted(const SwapCompletionCallback& callback,
+ gfx::SwapResult result) {
+ callback.Run(result);
swap_buffers_pending_ = false;
SubmitFrame();
@@ -358,16 +358,16 @@ class GL_EXPORT GLSurfaceOzoneSurfacelessSurfaceImpl
bool SupportsPostSubBuffer() override { return false; }
- bool SwapBuffers() override {
+ gfx::SwapResult SwapBuffers() override {
if (!images_[current_surface_]->ScheduleOverlayPlane(
widget_, 0, OverlayTransform::OVERLAY_TRANSFORM_NONE,
gfx::Rect(GetSize()), gfx::RectF(1, 1)))
- return false;
+ return gfx::SWAP_FAILED;
if (!GLSurfaceOzoneSurfaceless::SwapBuffers())
- return false;
+ return gfx::SWAP_FAILED;
current_surface_ ^= 1;
BindFramebuffer();
- return true;
+ return gfx::SWAP_ACK;
}
bool SwapBuffersAsync(const SwapCompletionCallback& callback) override {
« no previous file with comments | « ui/gl/gl_surface_osmesa.cc ('k') | ui/gl/gl_surface_stub.h » ('j') | ui/gl/gl_surface_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698