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

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: Make GetRealCurrent protected. 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
« no previous file with comments | « ui/gl/gl_context.h ('k') | ui/gl/gl_context_cgl.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..9229bb34c8cc39475d8492dbb8967cf9d8dcb4ed 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,16 @@ GLContext* GLContext::GetCurrent() {
return current_context_.Pointer()->Get();
}
+GLContext* GLContext::GetRealCurrent() {
+ return current_real_context_.Pointer()->Get();
+}
+
void GLContext::SetCurrent(GLContext* context, GLSurface* surface) {
+ DCHECK_EQ(!context, !surface);
+ if (!context || !context->IsVirtualContext()) {
greggman 2013/05/31 21:13:38 I feel like the suggestion of GLRealContext vs GLV
jonathan.backer 2013/06/03 14:57:23 Done with some slight modifications. Mostly used G
+ current_real_context_.Pointer()->Set(context);
+ GLSurface::SetRealCurrent(surface);
+ }
current_context_.Pointer()->Set(context);
GLSurface::SetCurrent(surface);
}
@@ -128,7 +140,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);
+ return result;
}
void GLContext::OnReleaseVirtuallyCurrent(GLContext* virtual_context) {
@@ -140,4 +155,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698