Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gl/gl_context_egl.h" | 5 #include "ui/gl/gl_context_egl.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 context_)) { | 108 context_)) { |
| 109 DVLOG(1) << "eglMakeCurrent failed with error " | 109 DVLOG(1) << "eglMakeCurrent failed with error " |
| 110 << GetLastEGLErrorString(); | 110 << GetLastEGLErrorString(); |
| 111 return false; | 111 return false; |
| 112 } | 112 } |
| 113 | 113 |
| 114 // Set this as soon as the context is current, since we might call into GL. | 114 // Set this as soon as the context is current, since we might call into GL. |
| 115 SetRealGLApi(); | 115 SetRealGLApi(); |
| 116 | 116 |
| 117 SetCurrent(surface); | 117 SetCurrent(surface); |
| 118 ScopedReleaseCurrent release_current(this, surface); | |
| 119 | |
| 118 if (!InitializeDynamicBindings()) { | 120 if (!InitializeDynamicBindings()) { |
| 119 ReleaseCurrent(surface); | |
| 120 return false; | 121 return false; |
| 121 } | 122 } |
| 122 | 123 |
| 123 if (!surface->OnMakeCurrent(this)) { | 124 if (!surface->OnMakeCurrent(this)) { |
|
no sievers
2014/04/01 22:51:32
I guess you could argue whether we should really R
piman
2014/04/01 23:00:02
yes.
no sievers
2014/04/01 23:39:37
Or should this be stronger and release any context
no sievers
2014/04/01 23:47:23
Actually, I just realized that this comment doesn'
piman
2014/04/01 23:50:58
I think it's best if we can have consistent semant
no sievers
2014/04/01 23:51:56
So what I'll do is make this consistent. Essential
| |
| 124 LOG(ERROR) << "Could not make current."; | 125 LOG(ERROR) << "Could not make current."; |
| 125 return false; | 126 return false; |
| 126 } | 127 } |
| 127 | 128 |
| 129 release_current.Release(); | |
| 128 return true; | 130 return true; |
| 129 } | 131 } |
| 130 | 132 |
| 131 void GLContextEGL::SetUnbindFboOnMakeCurrent() { | 133 void GLContextEGL::SetUnbindFboOnMakeCurrent() { |
| 132 unbind_fbo_on_makecurrent_ = true; | 134 unbind_fbo_on_makecurrent_ = true; |
| 133 } | 135 } |
| 134 | 136 |
| 135 void GLContextEGL::ReleaseCurrent(GLSurface* surface) { | 137 void GLContextEGL::ReleaseCurrent(GLSurface* surface) { |
| 136 if (!IsCurrent(surface)) | 138 if (!IsCurrent(surface)) |
| 137 return; | 139 return; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 | 200 |
| 199 #if !defined(OS_ANDROID) | 201 #if !defined(OS_ANDROID) |
| 200 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { | 202 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
| 201 DCHECK(bytes); | 203 DCHECK(bytes); |
| 202 *bytes = 0; | 204 *bytes = 0; |
| 203 return false; | 205 return false; |
| 204 } | 206 } |
| 205 #endif | 207 #endif |
| 206 | 208 |
| 207 } // namespace gfx | 209 } // namespace gfx |
| OLD | NEW |