Index: gpu/command_buffer/service/gl_context_virtual.cc |
diff --git a/gpu/command_buffer/service/gl_context_virtual.cc b/gpu/command_buffer/service/gl_context_virtual.cc |
index 7747407cf6dfba7887bd043afb45bd445fb1afba..0857a521787052d9eba3317cd21eab189f4baec0 100644 |
--- a/gpu/command_buffer/service/gl_context_virtual.cc |
+++ b/gpu/command_buffer/service/gl_context_virtual.cc |
@@ -6,6 +6,7 @@ |
#include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
#include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
+#include "ui/gl/gl_gl_api_implementation.h" |
#include "ui/gl/gl_surface.h" |
#include "ui/gl/gpu_timing.h" |
@@ -114,6 +115,21 @@ void GLContextVirtual::SetUnbindFboOnMakeCurrent() { |
shared_context_->SetUnbindFboOnMakeCurrent(); |
} |
+base::Closure GLContextVirtual::GetStateWasDirtiedExternallyCallback() { |
+ return shared_context_->GetStateWasDirtiedExternallyCallback(); |
+} |
+ |
+void GLContextVirtual::RestoreStateIfDirtiedExternally() { |
+ // The dirty bit should only be cleared after the state has been restored, |
+ // which should be done only when the context is current. |
+ DCHECK(IsCurrent(NULL)); |
+ if (!shared_context_->GetStateWasDirtiedExternally()) |
+ return; |
+ gfx::ScopedSetGLToRealGLApi scoped_set_gl_api; |
+ GetGLStateRestorer()->RestoreState(NULL); |
+ shared_context_->SetStateWasDirtiedExternally(false); |
+} |
+ |
GLContextVirtual::~GLContextVirtual() { |
Destroy(); |
} |