diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 17:37:36 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-18 17:37:36 +0000 |
commit | fe377e179b83f77f0ad65150f22d1b2a07f516dc (patch) | |
tree | b448d81085dbe2764ee51b4e3c683ed9c589b03d /ui/gfx/gl | |
parent | 07890d18d5874d213d3ddfa80ef80f0742ab699b (diff) | |
download | chromium_src-fe377e179b83f77f0ad65150f22d1b2a07f516dc.zip chromium_src-fe377e179b83f77f0ad65150f22d1b2a07f516dc.tar.gz chromium_src-fe377e179b83f77f0ad65150f22d1b2a07f516dc.tar.bz2 |
Add gl.dll, compositor.dll, and surface.dll.
I considered merging these into ui.dll, but the respective GYP files are pretty
customized, and merging all of the special casing into ui.gyp seemed like it
would just make things messy. Plus, some components only need to link to
surface and not all of ui.
One thing that I'm not entirely sure about is the naming convention. In this
case the modules are named gl, compositor and surface instead of ui_gfx_gl, and
so on. I thought about declaring UI_GFX_GL_EXPORT, but I opted for the shorter
GL_EXPORT instead. I think Ben has been thinking about moving these
directories out of ui/gfx/ anyways since it is a bit odd for them to live there.
R=rvargas
Originally reviewed at http://codereview.chromium.org/7645004
Review URL: http://codereview.chromium.org/7659017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/gl')
-rw-r--r-- | ui/gfx/gl/generate_bindings.py | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl.gyp | 6 | ||||
-rw-r--r-- | ui/gfx/gl/gl_bindings.h | 1 | ||||
-rw-r--r-- | ui/gfx/gl/gl_bindings_skia_in_process.h | 4 | ||||
-rw-r--r-- | ui/gfx/gl/gl_context.h | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl_context_stub.h | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl_export.h | 26 | ||||
-rw-r--r-- | ui/gfx/gl/gl_implementation.h | 5 | ||||
-rw-r--r-- | ui/gfx/gl/gl_interface.h | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl_share_group.h | 3 | ||||
-rw-r--r-- | ui/gfx/gl/gl_surface.h | 3 | ||||
-rw-r--r-- | ui/gfx/gl/gl_surface_egl.h | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl_surface_glx.h | 3 | ||||
-rw-r--r-- | ui/gfx/gl/gl_surface_stub.h | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl_switches.h | 18 |
15 files changed, 60 insertions, 21 deletions
diff --git a/ui/gfx/gl/generate_bindings.py b/ui/gfx/gl/generate_bindings.py index be38b71..055e4e4 100644 --- a/ui/gfx/gl/generate_bindings.py +++ b/ui/gfx/gl/generate_bindings.py @@ -486,7 +486,7 @@ def GenerateHeader(file, functions, set_name): # declaration. file.write('\n') for [return_type, names, arguments] in functions: - file.write('extern %sProc g_%s;\n' % (names[0], names[0])) + file.write('GL_EXPORT extern %sProc g_%s;\n' % (names[0], names[0])) file.write('\n') file.write( '} // namespace gfx\n') diff --git a/ui/gfx/gl/gl.gyp b/ui/gfx/gl/gl.gyp index 8e799ce..af328fe 100644 --- a/ui/gfx/gl/gl.gyp +++ b/ui/gfx/gl/gl.gyp @@ -10,7 +10,7 @@ 'targets': [ { 'target_name': 'gl', - 'type': 'static_library', + 'type': '<(component)', 'dependencies': [ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/skia/skia.gyp:skia', @@ -19,6 +19,9 @@ 'variables': { 'gl_binding_output_dir': '<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gl', }, + 'defines': [ + 'GL_IMPLEMENTATION', + ], 'include_dirs': [ '<(DEPTH)/third_party/swiftshader/include', '<(DEPTH)/third_party/mesa/MesaLib/include', @@ -43,6 +46,7 @@ 'gl_context_stub.cc', 'gl_context_stub.h', 'gl_context_win.cc', + 'gl_export.h', 'gl_implementation.cc', 'gl_implementation.h', 'gl_implementation_linux.cc', diff --git a/ui/gfx/gl/gl_bindings.h b/ui/gfx/gl/gl_bindings.h index fc47b60..3615e88 100644 --- a/ui/gfx/gl/gl_bindings.h +++ b/ui/gfx/gl/gl_bindings.h @@ -16,6 +16,7 @@ #include "build/build_config.h" #include "base/logging.h" +#include "ui/gfx/gl/gl_export.h" // The standard OpenGL native extension headers are also included. #if defined(OS_WIN) diff --git a/ui/gfx/gl/gl_bindings_skia_in_process.h b/ui/gfx/gl/gl_bindings_skia_in_process.h index 2905bf4..7863fe5 100644 --- a/ui/gfx/gl/gl_bindings_skia_in_process.h +++ b/ui/gfx/gl/gl_bindings_skia_in_process.h @@ -6,11 +6,13 @@ #define UI_GFX_GL_GL_BINDINGS_SKIA_IN_PROCESS_H_ #pragma once +#include "ui/gfx/gl/gl_export.h" + namespace gfx { // The GPU back-end for skia requires pointers to GL functions. This function // binds skia-gpu to the in-process GL -void BindSkiaToInProcessGL(); +GL_EXPORT void BindSkiaToInProcessGL(); } diff --git a/ui/gfx/gl/gl_context.h b/ui/gfx/gl/gl_context.h index ff88e0c..5340ada 100644 --- a/ui/gfx/gl/gl_context.h +++ b/ui/gfx/gl/gl_context.h @@ -17,7 +17,7 @@ namespace gfx { class GLSurface; // Encapsulates an OpenGL context, hiding platform specific management. -class GLContext : public base::RefCounted<GLContext> { +class GL_EXPORT GLContext : public base::RefCounted<GLContext> { public: explicit GLContext(GLShareGroup* share_group); diff --git a/ui/gfx/gl/gl_context_stub.h b/ui/gfx/gl/gl_context_stub.h index 44219a2..cb2ff6b 100644 --- a/ui/gfx/gl/gl_context_stub.h +++ b/ui/gfx/gl/gl_context_stub.h @@ -11,7 +11,7 @@ namespace gfx { // A GLContext that does nothing for unit tests. -class GLContextStub : public GLContext { +class GL_EXPORT GLContextStub : public GLContext { public: GLContextStub(); virtual ~GLContextStub(); diff --git a/ui/gfx/gl/gl_export.h b/ui/gfx/gl/gl_export.h new file mode 100644 index 0000000..a9cbe98 --- /dev/null +++ b/ui/gfx/gl/gl_export.h @@ -0,0 +1,26 @@ +// Copyright (c) 2011 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. + +#ifndef UI_GFX_GL_GL_EXPORT_H_ +#define UI_GFX_GL_GL_EXPORT_H_ +#pragma once + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) + +#if defined(GL_IMPLEMENTATION) +#define GL_EXPORT __declspec(dllexport) +#else +#define GL_EXPORT __declspec(dllimport) +#endif // defined(GL_IMPLEMENTATION) + +#else // defined(WIN32) +#define GL_EXPORT __attribute__((visibility("default"))) +#endif + +#else // defined(COMPONENT_BUILD) +#define GL_EXPORT +#endif + +#endif // UI_GFX_GL_GL_EXPORT_H_ diff --git a/ui/gfx/gl/gl_implementation.h b/ui/gfx/gl/gl_implementation.h index c3e3ca4..aab0bdf 100644 --- a/ui/gfx/gl/gl_implementation.h +++ b/ui/gfx/gl/gl_implementation.h @@ -10,6 +10,7 @@ #include "base/native_library.h" #include "build/build_config.h" +#include "ui/gfx/gl/gl_export.h" #include "ui/gfx/gl/gl_switches.h" namespace gfx { @@ -30,7 +31,7 @@ typedef void* (*GLGetProcAddressProc)(const char* name); #endif // Initialize a particular GL implementation. -bool InitializeGLBindings(GLImplementation implementation); +GL_EXPORT bool InitializeGLBindings(GLImplementation implementation); // Initialize Debug logging wrappers for GL bindings. void InitializeDebugGLBindings(); @@ -39,7 +40,7 @@ void InitializeDebugGLBindings(); void SetGLImplementation(GLImplementation implementation); // Get the current GL implementation. -GLImplementation GetGLImplementation(); +GL_EXPORT GLImplementation GetGLImplementation(); // Get the GL implementation with a given name. GLImplementation GetNamedGLImplementation(const std::wstring& name); diff --git a/ui/gfx/gl/gl_interface.h b/ui/gfx/gl/gl_interface.h index 79eb98b..c7fbf8a 100644 --- a/ui/gfx/gl/gl_interface.h +++ b/ui/gfx/gl/gl_interface.h @@ -14,7 +14,7 @@ namespace gfx { -class GLInterface { +class GL_EXPORT GLInterface { public: virtual ~GLInterface() { } diff --git a/ui/gfx/gl/gl_share_group.h b/ui/gfx/gl/gl_share_group.h index 33bebb9..a9f7529 100644 --- a/ui/gfx/gl/gl_share_group.h +++ b/ui/gfx/gl/gl_share_group.h @@ -10,13 +10,14 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" +#include "ui/gfx/gl/gl_export.h" namespace gfx { class GLContext; // A group of GL contexts that share an ID namespace. -class GLShareGroup : public base::RefCounted<GLShareGroup> { +class GL_EXPORT GLShareGroup : public base::RefCounted<GLShareGroup> { public: GLShareGroup(); diff --git a/ui/gfx/gl/gl_surface.h b/ui/gfx/gl/gl_surface.h index 1d6ddc2d..88b4f24 100644 --- a/ui/gfx/gl/gl_surface.h +++ b/ui/gfx/gl/gl_surface.h @@ -8,6 +8,7 @@ #include "base/memory/ref_counted.h" #include "build/build_config.h" +#include "ui/gfx/gl/gl_export.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" @@ -17,7 +18,7 @@ class GLContext; // Encapsulates a surface that can be rendered to with GL, hiding platform // specific management. -class GLSurface : public base::RefCounted<GLSurface> { +class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { public: GLSurface(); diff --git a/ui/gfx/gl/gl_surface_egl.h b/ui/gfx/gl/gl_surface_egl.h index e7caaff..237025b 100644 --- a/ui/gfx/gl/gl_surface_egl.h +++ b/ui/gfx/gl/gl_surface_egl.h @@ -29,7 +29,7 @@ typedef struct _XDisplay* EGLNativeDisplayType; namespace gfx { // Interface for EGL surface. -class GLSurfaceEGL : public GLSurface { +class GL_EXPORT GLSurfaceEGL : public GLSurface { public: GLSurfaceEGL(); virtual ~GLSurfaceEGL(); diff --git a/ui/gfx/gl/gl_surface_glx.h b/ui/gfx/gl/gl_surface_glx.h index 7d8872c..3a65c5f 100644 --- a/ui/gfx/gl/gl_surface_glx.h +++ b/ui/gfx/gl/gl_surface_glx.h @@ -8,13 +8,14 @@ #include "ui/gfx/gl/gl_surface.h" #include "ui/base/x/x11_util.h" +#include "ui/gfx/gl/gl_export.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" namespace gfx { // Base class for GLX surfaces. -class GLSurfaceGLX : public GLSurface { +class GL_EXPORT GLSurfaceGLX : public GLSurface { public: GLSurfaceGLX(); virtual ~GLSurfaceGLX(); diff --git a/ui/gfx/gl/gl_surface_stub.h b/ui/gfx/gl/gl_surface_stub.h index da494be..002a300 100644 --- a/ui/gfx/gl/gl_surface_stub.h +++ b/ui/gfx/gl/gl_surface_stub.h @@ -11,7 +11,7 @@ namespace gfx { // A GLSurface that does nothing for unit tests. -class GLSurfaceStub : public GLSurface { +class GL_EXPORT GLSurfaceStub : public GLSurface { public: virtual ~GLSurfaceStub(); diff --git a/ui/gfx/gl/gl_switches.h b/ui/gfx/gl/gl_switches.h index 74646c1..fd0cf5f 100644 --- a/ui/gfx/gl/gl_switches.h +++ b/ui/gfx/gl/gl_switches.h @@ -8,23 +8,25 @@ #define UI_GFX_GL_GL_SWITCHES_H_ #pragma once +#include "ui/gfx/gl/gl_export.h" + namespace gfx { // The GL implementation names that can be passed to --use-gl. -extern const char kGLImplementationDesktopName[]; -extern const char kGLImplementationOSMesaName[]; -extern const char kGLImplementationEGLName[]; +GL_EXPORT extern const char kGLImplementationDesktopName[]; +GL_EXPORT extern const char kGLImplementationOSMesaName[]; +GL_EXPORT extern const char kGLImplementationEGLName[]; extern const char kGLImplementationMockName[]; } // namespace gfx namespace switches { -extern const char kDisableGpuVsync[]; -extern const char kEnableGPUServiceLogging[]; -extern const char kEnableGPUClientLogging[]; -extern const char kGpuNoContextLost[]; -extern const char kUseGL[]; +GL_EXPORT extern const char kDisableGpuVsync[]; +GL_EXPORT extern const char kEnableGPUServiceLogging[]; +GL_EXPORT extern const char kEnableGPUClientLogging[]; +GL_EXPORT extern const char kGpuNoContextLost[]; +GL_EXPORT extern const char kUseGL[]; } // namespace switches |