summaryrefslogtreecommitdiffstats
path: root/ui/gl/gl_context_cgl.cc
diff options
context:
space:
mode:
authorsievers@google.com <sievers@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-02 18:37:12 +0000
committersievers@google.com <sievers@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-02 18:37:12 +0000
commit9552137be6d97cbdc02b26b9292b3268284ccec6 (patch)
tree44fa097590bd688e01aa1e155c91ccab908d8425 /ui/gl/gl_context_cgl.cc
parente0c621e6fb2a675e9b355f878e6978513777490b (diff)
downloadchromium_src-9552137be6d97cbdc02b26b9292b3268284ccec6.zip
chromium_src-9552137be6d97cbdc02b26b9292b3268284ccec6.tar.gz
chromium_src-9552137be6d97cbdc02b26b9292b3268284ccec6.tar.bz2
gpu: Bind dummy GL API when no context is current
Also make platform behavior consistent in always releasing any previously current context when MakeCurrent() fails. This catches GL call sites with no context current. It also avoids problems with GL implementations potentially not liking this (and crashing) or even us ending up calling into the wrong context (for example accidentally deleting a resource in the wrong context). BUG=355275 R=piman@chromium.org Review URL: https://codereview.chromium.org/221433004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261153 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl/gl_context_cgl.cc')
-rw-r--r--ui/gl/gl_context_cgl.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc
index 151c484d..141d935 100644
--- a/ui/gl/gl_context_cgl.cc
+++ b/ui/gl/gl_context_cgl.cc
@@ -178,6 +178,7 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) {
if (IsCurrent(surface))
return true;
+ ScopedReleaseCurrent release_current;
TRACE_EVENT0("gpu", "GLContextCGL::MakeCurrent");
if (CGLSetCurrentContext(
@@ -191,7 +192,6 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) {
SetCurrent(surface);
if (!InitializeDynamicBindings()) {
- ReleaseCurrent(surface);
return false;
}
@@ -200,6 +200,7 @@ bool GLContextCGL::MakeCurrent(GLSurface* surface) {
return false;
}
+ release_current.Cancel();
return true;
}