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

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: Created 7 years, 7 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.cc
diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc
index e26f75943b6564db26bb153f370fe278012f9bfa..144abbef16186b7e9c021ca717ca5d028ea597d8 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) {
@@ -90,7 +93,15 @@ GLContext* GLContext::GetCurrent() {
return current_context_.Pointer()->Get();
}
+GLContext* GLContext::GetRealCurrent() {
+ return current_real_context_.Pointer()->Get();
+}
+
void GLContext::SetCurrent(GLContext* context, GLSurface* surface) {
+ if (!context || !context->IsVirtualContext()) {
no sievers 2013/05/24 17:04:02 Do we allow SetCurrent(NULL, !NULL)? Or should we
jonathan.backer 2013/05/24 20:36:40 Yeah. I just looked at the OSX code (which might h
jonathan.backer 2013/05/27 16:37:36 Done.
+ current_real_context_.Pointer()->Set(context);
+ GLSurface::SetRealCurrent(surface);
+ }
current_context_.Pointer()->Set(context);
GLSurface::SetCurrent(surface);
}
@@ -128,7 +139,10 @@ void GLContext::SetupForVirtualization() {
bool GLContext::MakeVirtuallyCurrent(
GLContext* virtual_context, GLSurface* surface) {
DCHECK(virtual_gl_api_);
- return virtual_gl_api_->MakeCurrent(virtual_context, surface);
+ bool result = virtual_gl_api_->MakeCurrent(virtual_context, surface);
+ if (result)
+ SetCurrent(virtual_context, surface);
jonathan.backer 2013/05/23 21:00:53 Maybe SetCurrent(NULL, NULL) otherwise?
+ return result;
}
void GLContext::OnDestroyVirtualContext(GLContext* virtual_context) {
@@ -140,4 +154,8 @@ void GLContext::SetRealGLApi() {
SetGLToRealGLApi();
}
+bool GLContext::IsVirtualContext() {
+ return false;
+}
+
} // namespace gfx
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_context_cgl.cc » ('j') | ui/gl/gl_gl_api_implementation.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698