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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 144 } |
145 | 145 |
146 bool GLContextEGL::IsCurrent(GLSurface* surface) { | 146 bool GLContextEGL::IsCurrent(GLSurface* surface) { |
147 DCHECK(context_); | 147 DCHECK(context_); |
148 | 148 |
149 bool native_context_is_current = context_ == eglGetCurrentContext(); | 149 bool native_context_is_current = context_ == eglGetCurrentContext(); |
150 | 150 |
151 // If our context is current then our notion of which GLContext is | 151 // If our context is current then our notion of which GLContext is |
152 // current must be correct. On the other hand, third-party code | 152 // current must be correct. On the other hand, third-party code |
153 // using OpenGL might change the current context. | 153 // using OpenGL might change the current context. |
154 DCHECK(!native_context_is_current || (GetCurrent() == this)); | 154 DCHECK(!native_context_is_current || (GetRealCurrent() == this)); |
155 | 155 |
156 if (!native_context_is_current) | 156 if (!native_context_is_current) |
157 return false; | 157 return false; |
158 | 158 |
159 if (surface) { | 159 if (surface) { |
160 if (surface->GetHandle() != eglGetCurrentSurface(EGL_DRAW)) | 160 if (surface->GetHandle() != eglGetCurrentSurface(EGL_DRAW)) |
161 return false; | 161 return false; |
162 } | 162 } |
163 | 163 |
164 return true; | 164 return true; |
(...skipping 30 matching lines...) Expand all Loading... |
195 | 195 |
196 #if !defined(OS_ANDROID) | 196 #if !defined(OS_ANDROID) |
197 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { | 197 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
198 DCHECK(bytes); | 198 DCHECK(bytes); |
199 *bytes = 0; | 199 *bytes = 0; |
200 return false; | 200 return false; |
201 } | 201 } |
202 #endif | 202 #endif |
203 | 203 |
204 } // namespace gfx | 204 } // namespace gfx |
OLD | NEW |