Index: ui/gl/gl_implementation_wayland.cc |
diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_wayland.cc |
similarity index 81% |
copy from ui/gl/gl_implementation_android.cc |
copy to ui/gl/gl_implementation_wayland.cc |
index f644866b3d8e0aa257619b837ba50f77077913d2..d8b61c4945c1292288ee20b3a216a13428034e09 100644 |
--- a/ui/gl/gl_implementation_android.cc |
+++ b/ui/gl/gl_implementation_wayland.cc |
@@ -1,23 +1,27 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 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 <vector> |
+ |
#include "base/base_paths.h" |
#include "base/command_line.h" |
#include "base/files/file_path.h" |
#include "base/logging.h" |
#include "base/native_library.h" |
#include "base/path_service.h" |
+#include "base/threading/thread_restrictions.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_egl_api_implementation.h" |
#include "ui/gl/gl_gl_api_implementation.h" |
#include "ui/gl/gl_implementation.h" |
-#include "ui/gl/gl_osmesa_api_implementation.h" |
+#include "ui/gl/gl_switches.h" |
namespace gfx { |
- |
namespace { |
+// TODO(piman): it should be Desktop GL marshalling from double to float. Today |
+// on native GLES, we do float->double->float. |
void GL_BINDING_CALL MarshalClearDepthToClearDepthf(GLclampd depth) { |
glClearDepthf(static_cast<GLclampf>(depth)); |
} |
@@ -27,9 +31,11 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, |
glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); |
} |
+// Load a library, printing an error message on failure. |
base::NativeLibrary LoadLibrary(const base::FilePath& filename) { |
std::string error; |
- base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); |
+ base::NativeLibrary library = base::LoadNativeLibrary(filename, |
+ &error); |
if (!library) { |
DVLOG(1) << "Failed to load " << filename.MaybeAsASCII() << ": " << error; |
return NULL; |
@@ -54,12 +60,18 @@ bool InitializeGLBindings(GLImplementation implementation) { |
if (GetGLImplementation() != kGLImplementationNone) |
return true; |
+ // Allow the main thread or another to initialize these bindings |
+ // after instituting restrictions on I/O. Going forward they will |
+ // likely be used in the browser process on most platforms. The |
+ // one-time initialization cost is small, between 2 and 5 ms. |
+ base::ThreadRestrictions::ScopedAllowIO allow_io; |
+ |
switch (implementation) { |
case kGLImplementationEGLGLES2: { |
- base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); |
+ base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so.2"); |
if (!gles_library) |
return false; |
- base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); |
+ base::NativeLibrary egl_library = LoadLibrary("libEGL.so.1"); |
if (!egl_library) { |
base::UnloadNativeLibrary(gles_library); |
return false; |
@@ -97,15 +109,15 @@ bool InitializeGLBindings(GLImplementation implementation) { |
break; |
} |
default: |
- NOTIMPLEMENTED() << "InitializeGLBindings on Android"; |
return false; |
} |
+ |
return true; |
} |
bool InitializeGLExtensionBindings(GLImplementation implementation, |
- GLContext* context) { |
+ GLContext* context) { |
switch (implementation) { |
case kGLImplementationEGLGLES2: |
InitializeGLExtensionBindingsGL(context); |
@@ -122,6 +134,8 @@ bool InitializeGLExtensionBindings(GLImplementation implementation, |
} |
void InitializeDebugGLBindings() { |
+ InitializeDebugGLBindingsEGL(); |
+ InitializeDebugGLBindingsGL(); |
} |
void ClearGLBindings() { |