Index: ui/gl/gl_surface_ozone.cc |
diff --git a/ui/gl/gl_surface_android.cc b/ui/gl/gl_surface_ozone.cc |
similarity index 78% |
copy from ui/gl/gl_surface_android.cc |
copy to ui/gl/gl_surface_ozone.cc |
index 6c2565798a375b2b97783fe2612244314824fce9..40e0ec8cf18d954b4ec24f6d9abd5850992117f6 100644 |
--- a/ui/gl/gl_surface_android.cc |
+++ b/ui/gl/gl_surface_ozone.cc |
@@ -1,13 +1,12 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
#include "ui/gl/gl_surface.h" |
-#include <EGL/egl.h> |
- |
#include "base/logging.h" |
#include "base/memory/ref_counted.h" |
+#include "ui/base/ozone/surface_factory_ozone.h" |
rjkroege
2013/05/17 22:17:06
I'm not convinced that this file is worth refactor
piman
2013/05/18 01:47:19
TBH, with the suggested change to pass the VSyncPr
rjkroege
2013/05/21 17:36:28
Done.
|
#include "ui/gl/egl_util.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_context.h" |
@@ -26,6 +25,7 @@ bool GLSurface::InitializeOneOffInternal() { |
switch (GetGLImplementation()) { |
case kGLImplementationEGLGLES2: |
+ ui::SurfaceFactory::GetInstance()->InitializeHardware(); |
if (!GLSurfaceEGL::InitializeOneOff()) { |
LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
return false; |
@@ -39,6 +39,7 @@ bool GLSurface::InitializeOneOffInternal() { |
initialized = true; |
return true; |
} |
+ |
// static |
scoped_refptr<GLSurface> |
GLSurface::CreateViewGLSurface(bool software, gfx::AcceleratedWidget window) { |
@@ -52,7 +53,15 @@ GLSurface::CreateViewGLSurface(bool software, gfx::AcceleratedWidget window) { |
surface = new NativeViewGLSurfaceEGL(false, window); |
else |
surface = new GLSurfaceStub(); |
- if (!surface->Initialize()) |
+ bool success; |
+ if (GLSurfaceEGL::IsSyncControlSupported()) { |
+ success = surface->Initialize(); |
+ } else { |
+ VSyncProvider* sync_provider = |
+ ui::SurfaceFactory::GetInstance()->GetVSyncProvider(window); |
+ success = surface->Initialize(sync_provider); |
+ } |
+ if (!success) |
return NULL; |
return surface; |
} |