Index: ui/gl/gl_context.cc |
diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc |
index dd8aa266f5081559b0189a8a6a41fb76736e5f98..e64d031351560ef4c1324e640033fc25df329a1b 100644 |
--- a/ui/gl/gl_context.cc |
+++ b/ui/gl/gl_context.cc |
@@ -4,6 +4,8 @@ |
#include <string> |
+#include "base/bind.h" |
+#include "base/cancelable_callback.h" |
#include "base/command_line.h" |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
@@ -41,8 +43,15 @@ void GLContext::ScopedReleaseCurrent::Cancel() { |
GLContext::GLContext(GLShareGroup* share_group) : |
share_group_(share_group), |
+ state_dirtied_externally_(false), |
swap_interval_(1), |
- force_swap_interval_zero_(false) { |
+ force_swap_interval_zero_(false), |
+ state_dirtied_callback_( |
+ base::Bind(&GLContext::SetStateWasDirtiedExternally, |
+ // Note that if this is not unretained, it will create a cycle (and |
+ // will never be freed. |
+ base::Unretained(this), |
+ true)) { |
if (!share_group_.get()) |
share_group_ = new GLShareGroup; |
@@ -93,6 +102,24 @@ std::string GLContext::GetGLRenderer() { |
return std::string(renderer ? renderer : ""); |
} |
+base::Closure GLContext::GetStateWasDirtiedExternallyCallback() { |
+ return state_dirtied_callback_.callback(); |
+} |
+ |
+void GLContext::RestoreStateIfDirtiedExternally() { |
+ NOTREACHED(); |
+} |
+ |
+bool GLContext::GetStateWasDirtiedExternally() const { |
+ DCHECK(virtual_gl_api_); |
+ return state_dirtied_externally_; |
+} |
+ |
+void GLContext::SetStateWasDirtiedExternally(bool dirtied_externally) { |
+ DCHECK(virtual_gl_api_); |
+ state_dirtied_externally_ = dirtied_externally; |
+} |
+ |
bool GLContext::HasExtension(const char* name) { |
std::string extensions = GetExtensions(); |
extensions += " "; |