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
diff --git a/ui/gfx/compositor/compositor.gyp b/ui/gfx/compositor/compositor.gyp
index 010f973f..e8cbb3b 100644
--- a/ui/gfx/compositor/compositor.gyp
+++ b/ui/gfx/compositor/compositor.gyp
@@ -22,16 +22,20 @@
   'targets': [
     {
       'target_name': 'compositor',
-      'type': 'static_library',
+      'type': '<(component)',
       'dependencies': [
         '<(DEPTH)/base/base.gyp:base',
         '<(DEPTH)/skia/skia.gyp:skia',
         '<(DEPTH)/ui/gfx/gl/gl.gyp:gl',
         '<(DEPTH)/ui/ui.gyp:ui',
       ],
+      'defines': [
+        'COMPOSITOR_IMPLEMENTATION',
+      ],
       'sources': [
         'compositor.cc',
         'compositor.h',
+        'compositor_export.h',
         'compositor_gl.cc',
         'compositor_gl.h',
         'compositor_win.cc',
diff --git a/ui/gfx/compositor/compositor.h b/ui/gfx/compositor/compositor.h
index bd28bda..df575dd 100644
--- a/ui/gfx/compositor/compositor.h
+++ b/ui/gfx/compositor/compositor.h
@@ -7,6 +7,7 @@
 #pragma once
 
 #include "base/memory/ref_counted.h"
+#include "ui/gfx/compositor/compositor_export.h"
 #include "ui/gfx/transform.h"
 #include "ui/gfx/native_widget_types.h"
 
@@ -40,7 +41,7 @@
 // the bitmap.
 //
 // Views own the Texture.
-class Texture : public base::RefCounted<Texture> {
+class COMPOSITOR_EXPORT Texture : public base::RefCounted<Texture> {
  public:
   // Sets the canvas of this texture. The origin is at |origin|.
   // |overall_size| gives the total size of texture.
@@ -67,7 +68,7 @@
 // displayable form of pixels comprising a single widget's contents. It draws an
 // appropriately transformed texture for each transformed view in the widget's
 // view hierarchy.
-class Compositor : public base::RefCounted<Compositor> {
+class COMPOSITOR_EXPORT Compositor : public base::RefCounted<Compositor> {
  public:
   // Create a compositor from the provided handle.
   static Compositor* Create(gfx::AcceleratedWidget widget,
diff --git a/ui/gfx/compositor/compositor_export.h b/ui/gfx/compositor/compositor_export.h
new file mode 100644
index 0000000..2b1440bc
--- /dev/null
+++ b/ui/gfx/compositor/compositor_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_COMPOSITOR_COMPOSITOR_EXPORT_H_
+#define UI_GFX_COMPOSITOR_COMPOSITOR_EXPORT_H_
+#pragma once
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(COMPOSITOR_IMPLEMENTATION)
+#define COMPOSITOR_EXPORT __declspec(dllexport)
+#else
+#define COMPOSITOR_EXPORT __declspec(dllimport)
+#endif  // defined(COMPOSITOR_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#define COMPOSITOR_EXPORT __attribute__((visibility("default")))
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define COMPOSITOR_EXPORT
+#endif
+
+#endif  // UI_GFX_COMPOSITOR_COMPOSITOR_EXPORT_H_
diff --git a/ui/gfx/compositor/compositor_gl.h b/ui/gfx/compositor/compositor_gl.h
index 9699955..0872d1e 100644
--- a/ui/gfx/compositor/compositor_gl.h
+++ b/ui/gfx/compositor/compositor_gl.h
@@ -22,7 +22,7 @@
 class CompositorGL;
 class TextureProgramGL;
 
-class TextureGL : public Texture {
+class COMPOSITOR_EXPORT TextureGL : public Texture {
  public:
   explicit TextureGL(CompositorGL* compositor);
 
@@ -56,7 +56,7 @@
   DISALLOW_COPY_AND_ASSIGN(TextureGL);
 };
 
-class CompositorGL : public Compositor {
+class COMPOSITOR_EXPORT CompositorGL : public Compositor {
  public:
   CompositorGL(gfx::AcceleratedWidget widget, const gfx::Size& size);
   virtual ~CompositorGL();
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index 6e2438a..7bbc890 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -26,7 +26,7 @@
 // NOTE: unlike Views, each Layer does *not* own its children views. If you
 // delete a Layer and it has children, the parent of each child layer is set to
 // NULL, but the children are not deleted.
-class Layer {
+class COMPOSITOR_EXPORT Layer {
  public:
   explicit Layer(Compositor* compositor);
   ~Layer();
diff --git a/ui/gfx/compositor/layer_animator.h b/ui/gfx/compositor/layer_animator.h
index c30ba87..4570e26 100644
--- a/ui/gfx/compositor/layer_animator.h
+++ b/ui/gfx/compositor/layer_animator.h
@@ -14,6 +14,7 @@
 #include "third_party/skia/include/utils/SkMatrix44.h"
 #include "ui/base/animation/animation_delegate.h"
 #include "ui/base/animation/tween.h"
+#include "ui/gfx/compositor/compositor_export.h"
 #include "ui/gfx/point.h"
 
 namespace ui {
@@ -23,7 +24,7 @@
 class Transform;
 
 // LayerAnimator manages animating various properties of a Layer.
-class LayerAnimator : public ui::AnimationDelegate {
+class COMPOSITOR_EXPORT LayerAnimator : public ui::AnimationDelegate {
  public:
   explicit LayerAnimator(Layer* layer);
   virtual ~LayerAnimator();
diff --git a/ui/gfx/gl/generate_bindings.py b/ui/gfx/gl/generate_bindings.py
index be38b71..055e4e49 100644
--- a/ui/gfx/gl/generate_bindings.py
+++ b/ui/gfx/gl/generate_bindings.py
@@ -486,7 +486,7 @@
   # 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..af328fe9a 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..3615e885 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 ff88e0c0..5340ada 100644
--- a/ui/gfx/gl/gl_context.h
+++ b/ui/gfx/gl/gl_context.h
@@ -17,7 +17,7 @@
 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..aab0bdf7 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 @@
 #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 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 33bebb90..a9f75299b 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..88b4f246 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 @@
 
 // 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 e7caaffd..237025b6 100644
--- a/ui/gfx/gl/gl_surface_egl.h
+++ b/ui/gfx/gl/gl_surface_egl.h
@@ -29,7 +29,7 @@
 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..fd0cf5ff 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
 
diff --git a/ui/gfx/surface/accelerated_surface_linux.h b/ui/gfx/surface/accelerated_surface_linux.h
index b905712..e7882b8 100644
--- a/ui/gfx/surface/accelerated_surface_linux.h
+++ b/ui/gfx/surface/accelerated_surface_linux.h
@@ -8,10 +8,12 @@
 
 #include "base/memory/ref_counted.h"
 #include "ui/gfx/size.h"
+#include "ui/gfx/surface/surface_export.h"
 
 // The GL context associated with the surface must be current when
 // an instance is created or destroyed.
-class AcceleratedSurface : public base::RefCounted<AcceleratedSurface> {
+class SURFACE_EXPORT AcceleratedSurface
+    : public base::RefCounted<AcceleratedSurface> {
  public:
   AcceleratedSurface(const gfx::Size& size);
   const gfx::Size& size() const { return size_; }
diff --git a/ui/gfx/surface/accelerated_surface_mac.h b/ui/gfx/surface/accelerated_surface_mac.h
index ad133a84..5163a57 100644
--- a/ui/gfx/surface/accelerated_surface_mac.h
+++ b/ui/gfx/surface/accelerated_surface_mac.h
@@ -15,6 +15,7 @@
 #include "ui/gfx/size.h"
 #include "ui/gfx/gl/gl_context.h"
 #include "ui/gfx/gl/gl_surface.h"
+#include "ui/gfx/surface/surface_export.h"
 #include "ui/gfx/surface/transport_dib.h"
 
 // Should not include GL headers in a header file. Forward declare these types
@@ -32,7 +33,7 @@
 // uses a regular dib. There will either be an IOSurface or a TransportDIB,
 // never both.
 
-class AcceleratedSurface {
+class SURFACE_EXPORT AcceleratedSurface {
  public:
   AcceleratedSurface();
   virtual ~AcceleratedSurface();
diff --git a/ui/gfx/surface/accelerated_surface_wayland.h b/ui/gfx/surface/accelerated_surface_wayland.h
index c4418e4..3deda3c7 100644
--- a/ui/gfx/surface/accelerated_surface_wayland.h
+++ b/ui/gfx/surface/accelerated_surface_wayland.h
@@ -8,12 +8,14 @@
 
 #include "base/memory/ref_counted.h"
 #include "ui/gfx/size.h"
+#include "ui/gfx/surface/surface_export.h"
 
 struct wl_egl_pixmap;
 
 // The GL context associated with the surface must be current when
 // an instance is created or destroyed.
-class AcceleratedSurface : public base::RefCounted<AcceleratedSurface> {
+class SURFACE_EXPORT AcceleratedSurface
+    : public base::RefCounted<AcceleratedSurface> {
  public:
   AcceleratedSurface(const gfx::Size& size);
   const gfx::Size& size() const { return size_; }
diff --git a/ui/gfx/surface/io_surface_support_mac.h b/ui/gfx/surface/io_surface_support_mac.h
index e8d01b9..b49dbfe 100644
--- a/ui/gfx/surface/io_surface_support_mac.h
+++ b/ui/gfx/surface/io_surface_support_mac.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
 
@@ -11,6 +11,7 @@
 #include <OpenGL/OpenGL.h>
 
 #include "base/basictypes.h"
+#include "ui/gfx/surface/surface_export.h"
 
 // This Mac OS X-specific class provides dynamically-linked access to
 // IOSurface.framework, which is only available on 10.6 and later.
@@ -20,7 +21,7 @@
 // See IOSurface/IOSurfaceAPI.h and OpenGL/CGLIOSurface.h on 10.6 for
 // documentation of the fields and methods of this class.
 
-class IOSurfaceSupport {
+class SURFACE_EXPORT IOSurfaceSupport {
  public:
   // Returns an instance of the IOSurfaceSupport class if the
   // operating system supports it, NULL otherwise. It is safe to call
diff --git a/ui/gfx/surface/surface.gyp b/ui/gfx/surface/surface.gyp
index 9e7081d..231dcbb 100644
--- a/ui/gfx/surface/surface.gyp
+++ b/ui/gfx/surface/surface.gyp
@@ -19,7 +19,7 @@
   'targets': [
     {
       'target_name': 'surface',
-      'type': 'static_library',
+      'type': '<(component)',
       'dependencies': [
         '<(DEPTH)/base/base.gyp:base',
         '<(DEPTH)/skia/skia.gyp:skia',
@@ -35,11 +35,15 @@
         'accelerated_surface_wayland.h',
         'io_surface_support_mac.cc',
         'io_surface_support_mac.h',
+        'surface_export.h',
         'transport_dib.h',
         'transport_dib_linux.cc',
         'transport_dib_mac.cc',
         'transport_dib_win.cc',
       ],
+      'defines': [
+        'SURFACE_IMPLEMENTATION',
+      ],
       'conditions': [
         ['use_wayland == 1', {
           'sources/': [
diff --git a/ui/gfx/surface/surface_export.h b/ui/gfx/surface/surface_export.h
new file mode 100644
index 0000000..9b8420a4
--- /dev/null
+++ b/ui/gfx/surface/surface_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_SURFACE_SURFACE_EXPORT_H_
+#define UI_GFX_SURFACE_SURFACE_EXPORT_H_
+#pragma once
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(SURFACE_IMPLEMENTATION)
+#define SURFACE_EXPORT __declspec(dllexport)
+#else
+#define SURFACE_EXPORT __declspec(dllimport)
+#endif  // defined(SURFACE_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#define SURFACE_EXPORT __attribute__((visibility("default")))
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define SURFACE_EXPORT
+#endif
+
+#endif  // UI_GFX_SURFACE_SURFACE_EXPORT_H_
diff --git a/ui/gfx/surface/transport_dib.h b/ui/gfx/surface/transport_dib.h
index 1834eec..6a8d0e0e 100644
--- a/ui/gfx/surface/transport_dib.h
+++ b/ui/gfx/surface/transport_dib.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
 
@@ -7,6 +7,7 @@
 #pragma once
 
 #include "base/basictypes.h"
+#include "ui/gfx/surface/surface_export.h"
 
 #if defined(OS_WIN) || defined(OS_MACOSX)
 #include "base/shared_memory.h"
@@ -27,7 +28,7 @@
 // between processes: from the renderer process to the browser, and
 // between renderer and plugin processes.
 // -----------------------------------------------------------------------------
-class TransportDIB {
+class SURFACE_EXPORT TransportDIB {
  public:
   ~TransportDIB();