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

Unified Diff: ui/gl/gl_context.cc

Issue 15928002: GPU: Keep track of the last real context and real surface made current. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nix unnecessary changes. Created 7 years, 6 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
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_context_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context.cc
diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc
index 496ed964e5e0f4f491556d4fe97f20169c8b32af..1bc4d122d1c4c74973aefa428947c851c7ef2b3f 100644
--- a/ui/gl/gl_context.cc
+++ b/ui/gl/gl_context.cc
@@ -20,6 +20,9 @@ namespace gfx {
namespace {
base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky
current_context_ = LAZY_INSTANCE_INITIALIZER;
+
+base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky
+ current_real_context_ = LAZY_INSTANCE_INITIALIZER;
} // namespace
GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) {
@@ -32,7 +35,7 @@ GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) {
GLContext::~GLContext() {
share_group_->RemoveContext(this);
if (GetCurrent() == this) {
- SetCurrent(NULL, NULL);
+ SetCurrent(NULL);
}
}
@@ -90,8 +93,12 @@ GLContext* GLContext::GetCurrent() {
return current_context_.Pointer()->Get();
}
-void GLContext::SetCurrent(GLContext* context, GLSurface* surface) {
- current_context_.Pointer()->Set(context);
+GLContext* GLContext::GetRealCurrent() {
+ return current_real_context_.Pointer()->Get();
+}
+
+void GLContext::SetCurrent(GLSurface* surface) {
+ current_context_.Pointer()->Set(surface ? this : NULL);
GLSurface::SetCurrent(surface);
}
@@ -140,4 +147,14 @@ void GLContext::SetRealGLApi() {
SetGLToRealGLApi();
}
+GLContextReal::GLContextReal(GLShareGroup* share_group)
+ : GLContext(share_group) {}
+
+GLContextReal::~GLContextReal() {}
+
+void GLContextReal::SetCurrent(GLSurface* surface) {
+ GLContext::SetCurrent(surface);
+ current_real_context_.Pointer()->Set(surface ? this : NULL);
+}
+
} // namespace gfx
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_context_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698