Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / gl / gl_context_egl.cc
index 6cd5d4c..52777de 100644 (file)
@@ -177,10 +177,18 @@ void* GLContextEGL::GetHandle() {
 }
 
 void GLContextEGL::SetSwapInterval(int interval) {
-  DCHECK(IsCurrent(NULL));
+  DCHECK(IsCurrent(NULL) && GLSurface::GetCurrent());
+
+  // This is a surfaceless context. eglSwapInterval doesn't take any effect in
+  // this case and will just return EGL_BAD_SURFACE.
+  if (GLSurface::GetCurrent()->IsSurfaceless())
+    return;
+
   if (!eglSwapInterval(display_, interval)) {
     LOG(ERROR) << "eglSwapInterval failed with error "
                << GetLastEGLErrorString();
+  } else {
+    GLSurface::GetCurrent()->SetSwapInterval(interval);
   }
 }