Index: ui/gl/gl_context.h |
diff --git a/ui/gl/gl_context.h b/ui/gl/gl_context.h |
index 4577be31cc370673742358c8b76fe465bb15c702..95986613e0b7e3f1392f11dc70be8b6834f59538 100644 |
--- a/ui/gl/gl_context.h |
+++ b/ui/gl/gl_context.h |
@@ -9,6 +9,7 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/cancelable_callback.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/synchronization/cancellation_flag.h" |
@@ -16,6 +17,10 @@ |
#include "ui/gl/gl_state_restorer.h" |
#include "ui/gl/gpu_preference.h" |
+namespace gpu { |
+class GLContextVirtual; |
+} // namespace gpu |
+ |
namespace gfx { |
class GLSurface; |
@@ -130,6 +135,14 @@ class GL_EXPORT GLContext : public base::RefCounted<GLContext> { |
// Returns the GL renderer string. The context must be current. |
virtual std::string GetGLRenderer(); |
+ // Return a callback that, when called, indicates that the state the |
+ // underlying context has been changed by code outside of the command buffer, |
+ // and will need to be restored. |
+ virtual base::Closure GetStateWasDirtiedExternallyCallback(); |
+ |
+ // Restore the context's state if it was dirtied by an external caller. |
+ virtual void RestoreStateIfDirtiedExternally(); |
+ |
protected: |
virtual ~GLContext(); |
@@ -159,20 +172,27 @@ class GL_EXPORT GLContext : public base::RefCounted<GLContext> { |
virtual void OnSetSwapInterval(int interval) = 0; |
+ bool GetStateWasDirtiedExternally() const; |
+ void SetStateWasDirtiedExternally(bool dirtied_externally); |
+ |
private: |
friend class base::RefCounted<GLContext>; |
// For GetRealCurrent. |
friend class VirtualGLApi; |
+ friend class gpu::GLContextVirtual; |
scoped_refptr<GLShareGroup> share_group_; |
scoped_ptr<VirtualGLApi> virtual_gl_api_; |
+ bool state_dirtied_externally_; |
scoped_ptr<GLStateRestorer> state_restorer_; |
scoped_ptr<GLVersionInfo> version_info_; |
int swap_interval_; |
bool force_swap_interval_zero_; |
+ base::CancelableCallback<void()> state_dirtied_callback_; |
+ |
DISALLOW_COPY_AND_ASSIGN(GLContext); |
}; |