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/command_line.h" | 7 #include "base/command_line.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 "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 LOG(ERROR) << "eglDestroyContext failed with error " | 91 LOG(ERROR) << "eglDestroyContext failed with error " |
92 << GetLastEGLErrorString(); | 92 << GetLastEGLErrorString(); |
93 } | 93 } |
94 | 94 |
95 context_ = nullptr; | 95 context_ = nullptr; |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 bool GLContextEGL::MakeCurrent(GLSurface* surface) { | 99 bool GLContextEGL::MakeCurrent(GLSurface* surface) { |
100 DCHECK(context_); | 100 DCHECK(context_); |
| 101 |
| 102 if (!surface) { |
| 103 ReleaseCurrent(nullptr); |
| 104 return true; |
| 105 } |
| 106 |
101 if (IsCurrent(surface)) | 107 if (IsCurrent(surface)) |
102 return true; | 108 return true; |
103 | 109 |
104 ScopedReleaseCurrent release_current; | 110 ScopedReleaseCurrent release_current; |
105 TRACE_EVENT2("gpu", "GLContextEGL::MakeCurrent", | 111 TRACE_EVENT2("gpu", "GLContextEGL::MakeCurrent", |
106 "context", context_, | 112 "context", context_, |
107 "surface", surface); | 113 "surface", surface); |
108 | 114 |
109 if (unbind_fbo_on_makecurrent_ && | 115 if (unbind_fbo_on_makecurrent_ && |
110 eglGetCurrentContext() != EGL_NO_CONTEXT) { | 116 eglGetCurrentContext() != EGL_NO_CONTEXT) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 224 |
219 #if !defined(OS_ANDROID) | 225 #if !defined(OS_ANDROID) |
220 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { | 226 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
221 DCHECK(bytes); | 227 DCHECK(bytes); |
222 *bytes = 0; | 228 *bytes = 0; |
223 return false; | 229 return false; |
224 } | 230 } |
225 #endif | 231 #endif |
226 | 232 |
227 } // namespace gfx | 233 } // namespace gfx |
OLD | NEW |