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

Unified Diff: ui/gl/gl_context.h

Issue 197563003: gpu: Allow fences to check whether a flush has occurred (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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_context.h
diff --git a/ui/gl/gl_context.h b/ui/gl/gl_context.h
index f40b1bba78647ab9ef7090ffa420e4c5ba1b739c..38e5ea8454b8ad5dac7cfbfc6ec9e9b0e56dbfcf 100644
--- a/ui/gl/gl_context.h
+++ b/ui/gl/gl_context.h
@@ -6,7 +6,9 @@
#define UI_GL_GL_CONTEXT_H_
#include <string>
+#include <vector>
+#include "base/atomicops.h"
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -32,6 +34,22 @@ class GL_EXPORT GLContext : public base::RefCounted<GLContext> {
virtual bool Initialize(
GLSurface* compatible_surface, GpuPreference gpu_preference) = 0;
+ class FlushEvent : public base::RefCountedThreadSafe<FlushEvent> {
+ public:
+ bool IsSignaled();
+
+ private:
+ friend class base::RefCountedThreadSafe<FlushEvent>;
+ friend class GLContext;
+ FlushEvent();
+ virtual ~FlushEvent();
+ void Signal();
+
+ base::subtle::Atomic32 state_;
+ };
+
+ scoped_refptr<FlushEvent> SignalFlush();
+
// Destroys the GL context.
virtual void Destroy() = 0;
@@ -114,6 +132,9 @@ class GL_EXPORT GLContext : public base::RefCounted<GLContext> {
// Returns the GL renderer string. The context must be current.
virtual std::string GetGLRenderer();
+ // Called when glFlush()/glFinish() is called with this context current.
+ void OnFlush();
+
protected:
virtual ~GLContext();
@@ -140,6 +161,8 @@ class GL_EXPORT GLContext : public base::RefCounted<GLContext> {
scoped_ptr<GLStateRestorer> state_restorer_;
scoped_ptr<GLVersionInfo> version_info_;
+ std::vector<scoped_refptr<FlushEvent> > flush_events_;
+
DISALLOW_COPY_AND_ASSIGN(GLContext);
};

Powered by Google App Engine
This is Rietveld 408576698