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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 DCHECK(IsCurrent(NULL) && GLSurface::GetCurrent()); | 176 DCHECK(IsCurrent(NULL) && GLSurface::GetCurrent()); |
177 | 177 |
178 // This is a surfaceless context. eglSwapInterval doesn't take any effect in | 178 // This is a surfaceless context. eglSwapInterval doesn't take any effect in |
179 // this case and will just return EGL_BAD_SURFACE. | 179 // this case and will just return EGL_BAD_SURFACE. |
180 if (GLSurface::GetCurrent()->IsSurfaceless()) | 180 if (GLSurface::GetCurrent()->IsSurfaceless()) |
181 return; | 181 return; |
182 | 182 |
183 if (!eglSwapInterval(display_, interval)) { | 183 if (!eglSwapInterval(display_, interval)) { |
184 LOG(ERROR) << "eglSwapInterval failed with error " | 184 LOG(ERROR) << "eglSwapInterval failed with error " |
185 << GetLastEGLErrorString(); | 185 << GetLastEGLErrorString(); |
186 } else { | |
187 GLSurface::GetCurrent()->SetSwapInterval(interval); | |
188 } | 186 } |
189 } | 187 } |
190 | 188 |
191 std::string GLContextEGL::GetExtensions() { | 189 std::string GLContextEGL::GetExtensions() { |
192 const char* extensions = eglQueryString(display_, | 190 const char* extensions = eglQueryString(display_, |
193 EGL_EXTENSIONS); | 191 EGL_EXTENSIONS); |
194 if (!extensions) | 192 if (!extensions) |
195 return GLContext::GetExtensions(); | 193 return GLContext::GetExtensions(); |
196 | 194 |
197 return GLContext::GetExtensions() + " " + extensions; | 195 return GLContext::GetExtensions() + " " + extensions; |
198 } | 196 } |
199 | 197 |
200 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { | 198 bool GLContextEGL::WasAllocatedUsingRobustnessExtension() { |
201 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); | 199 return GLSurfaceEGL::IsCreateContextRobustnessSupported(); |
202 } | 200 } |
203 | 201 |
204 GLContextEGL::~GLContextEGL() { | 202 GLContextEGL::~GLContextEGL() { |
205 Destroy(); | 203 Destroy(); |
206 } | 204 } |
207 | 205 |
208 #if !defined(OS_ANDROID) | 206 #if !defined(OS_ANDROID) |
209 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { | 207 bool GLContextEGL::GetTotalGpuMemory(size_t* bytes) { |
210 DCHECK(bytes); | 208 DCHECK(bytes); |
211 *bytes = 0; | 209 *bytes = 0; |
212 return false; | 210 return false; |
213 } | 211 } |
214 #endif | 212 #endif |
215 | 213 |
216 } // namespace gfx | 214 } // namespace gfx |
OLD | NEW |