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

Unified Diff: ui/gl/gl_surface.h

Issue 797843005: Add support to delay sending SwapbufferAck as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add SwapBufferCallBack in Helper. Created 6 years 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.h
diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h
index ec04c9626dab43a7c4565846909cf17eadcf0324..744ec069fbe8fc0090b7c9454fe7a9614b8036dd 100644
--- a/ui/gl/gl_surface.h
+++ b/ui/gl/gl_surface.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "ui/gfx/native_widget_types.h"
@@ -72,9 +73,27 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
// FBO. Otherwise returns 0.
virtual unsigned int GetBackingFrameBufferObject();
+ typedef base::Callback<void()> SwapCompletionCallback;
+ // Swaps front and back buffers. This has no effect for off-screen
+ // contexts. On some platforms, we want to send SwapBufferAck only after the
+ // surface is displayed on screen. The callback can be used to delay sending
+ // SwapBufferAck till that data is available. The callback should be run on
+ // GPUMainThread only.
piman 2014/12/22 20:53:15 nit: in ui/gl there's no notion of GpuMainThread.
kalyank 2014/12/23 11:22:42 Done.
+ virtual bool SwapBuffersAsync(const SwapCompletionCallback& callback);
+
// Copy part of the backbuffer to the frontbuffer.
virtual bool PostSubBuffer(int x, int y, int width, int height);
+ // Copy part of the backbuffer to the frontbuffer. On some platforms, we want
+ // to send SwapBufferAck only after the surface is displayed on screen. The
+ // callback can be used to delay sending SwapBufferAck till that data is
+ // available. The callback should be run on GPUMainThread only.
+ virtual bool PostSubBufferAsync(int x,
+ int y,
+ int width,
+ int height,
+ const SwapCompletionCallback& callback);
+
// Initialize GL bindings.
static bool InitializeOneOff();
@@ -173,7 +192,13 @@ class GL_EXPORT GLSurfaceAdapter : public GLSurface {
bool DeferDraws() override;
bool IsOffscreen() override;
bool SwapBuffers() override;
+ bool SwapBuffersAsync(const SwapCompletionCallback& callback) override;
bool PostSubBuffer(int x, int y, int width, int height) override;
+ bool PostSubBufferAsync(int x,
+ int y,
+ int width,
+ int height,
+ const SwapCompletionCallback& callback) override;
bool SupportsPostSubBuffer() override;
gfx::Size GetSize() override;
void* GetHandle() override;

Powered by Google App Engine
This is Rietveld 408576698