Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / gl / gl_context_egl.cc
index 2554f8c..52777de 100644 (file)
@@ -112,6 +112,10 @@ bool GLContextEGL::MakeCurrent(GLSurface* surface) {
     return false;
   }
 
+#if defined(USE_OZONE)
+  eglSwapInterval(display_, 0);
+#endif
+
   // Set this as soon as the context is current, since we might call into GL.
   SetRealGLApi();
 
@@ -173,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);
   }
 }