Extract //gpu:gles2 into a separate component

This makes //gpu not depend on GLES2 details and will help reuse for
RasterDecoder and, later, Vulkan things.

Bug: 795884
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I4b223e7bbd2a1596ae83feb8f7ab1f1ce2a186aa
Reviewed-on: https://chromium-review.googlesource.com/851446
Commit-Queue: Antoine Labour <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Dan Sanders <[email protected]>
Reviewed-by: Sadrul Chowdhury <[email protected]>
Reviewed-by: Victor Miura <[email protected]>
Cr-Commit-Position: refs/heads/master@{#528240}
diff --git a/components/viz/common/gpu/in_process_context_provider.cc b/components/viz/common/gpu/in_process_context_provider.cc
index 7fceb9b..d85e714 100644
--- a/components/viz/common/gpu/in_process_context_provider.cc
+++ b/components/viz/common/gpu/in_process_context_provider.cc
@@ -16,10 +16,8 @@
 #include "gpu/command_buffer/client/gles2_implementation.h"
 #include "gpu/command_buffer/client/raster_implementation_gles.h"
 #include "gpu/command_buffer/common/context_creation_attribs.h"
-#include "gpu/command_buffer/service/framebuffer_completeness_cache.h"
 #include "gpu/command_buffer/service/gpu_preferences.h"
 #include "gpu/command_buffer/service/mailbox_manager.h"
-#include "gpu/command_buffer/service/shader_translator_cache.h"
 #include "gpu/command_buffer/service/sync_point_manager.h"
 #include "gpu/config/gpu_feature_info.h"
 #include "gpu/ipc/common/surface_handle.h"
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn
index 5bb4fc4..920207f 100644
--- a/content/public/browser/BUILD.gn
+++ b/content/public/browser/BUILD.gn
@@ -331,6 +331,7 @@
     "//device/geolocation",
     "//device/usb/public/interfaces",
     "//gpu",
+    "//gpu/command_buffer/service:gles2",
     "//media",
     "//net",
     "//ppapi/c",
diff --git a/gpu/BUILD.gn b/gpu/BUILD.gn
index 8352b5b..4b51ca8 100644
--- a/gpu/BUILD.gn
+++ b/gpu/BUILD.gn
@@ -11,6 +11,10 @@
   defines = [ "GPU_IMPLEMENTATION" ]
 }
 
+config("gpu_gles2_implementation") {
+  defines = [ "GPU_GLES2_IMPLEMENTATION" ]
+}
+
 config("gpu_util_implementation") {
   defines = [ "GPU_UTIL_IMPLEMENTATION" ]
 }
@@ -18,10 +22,7 @@
 component("gpu") {
   public_deps = [
     "//gpu/command_buffer/client:client_sources",
-    "//gpu/command_buffer/client:gles2_cmd_helper_sources",
     "//gpu/command_buffer/common:common_sources",
-    "//gpu/command_buffer/common:gles2_sources",
-    "//gpu/command_buffer/service:gles2_sources",
     "//gpu/command_buffer/service:service_sources",
     "//gpu/config:config_sources",
     "//gpu/ipc/client:ipc_client_sources",
@@ -29,6 +30,14 @@
   ]
 }
 
+component("gles2") {
+  public_deps = [
+    "//gpu/command_buffer/client:gles2_cmd_helper_sources",
+    "//gpu/command_buffer/common:gles2_sources",
+    "//gpu/command_buffer/service:gles2_sources",
+  ]
+}
+
 component("gpu_util") {
   public_deps = [
     "//gpu/ipc/common:gpu_preferences_util_sources",
@@ -59,7 +68,9 @@
       "//base",
       "//build/config:exe_and_shlib_deps",
       "//gpu/command_buffer/client:gles2_c_lib",
+      "//gpu/command_buffer/client:gles2_cmd_helper",
       "//gpu/command_buffer/client:gles2_implementation",
+      "//gpu/command_buffer/service:gles2",
       "//ui/gl",
       "//ui/gl/init",
     ]
@@ -129,6 +140,7 @@
   ]
 
   public_deps = [
+    ":gles2",
     ":gpu",
     "//gpu/command_buffer/client:gles2_interface",
   ]
@@ -202,6 +214,7 @@
   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
 
   deps = [
+    ":gles2",
     ":gpu",
     ":test_support",
     "//base",
@@ -385,6 +398,7 @@
   configs += [ "//build/config:precompiled_headers" ]
 
   deps = [
+    ":gles2",
     ":gpu",
     ":test_support",
     "//base",
@@ -468,7 +482,9 @@
     ":gpu",
     "//base",
     "//base/test:test_support",
+    "//gpu/command_buffer/client:gles2_cmd_helper",
     "//gpu/command_buffer/client:gles2_implementation",
+    "//gpu/command_buffer/service:gles2",
     "//testing/gtest",
     "//testing/perf",
     "//ui/gfx/geometry",
@@ -494,6 +510,7 @@
   ]
 
   deps = [
+    ":gles2",
     ":gpu",
     "//base",
     "//base/third_party/dynamic_annotations",
@@ -514,6 +531,7 @@
     defines = [ "GPU_FUZZER_USE_ANGLE" ]
 
     deps = [
+      ":gles2",
       ":gpu",
       "//base",
       "//base/third_party/dynamic_annotations",
@@ -536,6 +554,7 @@
     ]
 
     deps = [
+      ":gles2",
       ":gpu",
       "//base",
       "//base/third_party/dynamic_annotations",
@@ -555,6 +574,7 @@
     defines = [ "GPU_FUZZER_USE_SWIFTSHADER" ]
 
     deps = [
+      ":gles2",
       ":gpu",
       "//base",
       "//base/third_party/dynamic_annotations",
diff --git a/gpu/command_buffer/client/BUILD.gn b/gpu/command_buffer/client/BUILD.gn
index 2bc585f..bdfa5d7 100644
--- a/gpu/command_buffer/client/BUILD.gn
+++ b/gpu/command_buffer/client/BUILD.gn
@@ -20,7 +20,7 @@
 group("gles2_cmd_helper") {
   if (is_component_build) {
     public_deps = [
-      "//gpu",
+      "//gpu:gles2",
     ]
   } else {
     public_deps = [
@@ -81,12 +81,12 @@
     "gles2_cmd_helper_autogen.h",
   ]
 
-  configs += [ "//gpu:gpu_implementation" ]
+  configs += [ "//gpu:gpu_gles2_implementation" ]
 
   deps = [
-    ":client_sources",
+    ":client",
     "//base",
-    "//gpu/command_buffer/common:common_sources",
+    "//gpu/command_buffer/common",
     "//gpu/command_buffer/common:gles2_sources",
   ]
 }
diff --git a/gpu/command_buffer/client/gles2_cmd_helper.h b/gpu/command_buffer/client/gles2_cmd_helper.h
index bbcb89e5..4c31d1e 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper.h
@@ -10,13 +10,13 @@
 #include "base/macros.h"
 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
 #include "gpu/command_buffer/common/gles2_cmd_format.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
 
 // A class that helps write GL command buffers.
-class GPU_EXPORT GLES2CmdHelper : public CommandBufferHelper {
+class GPU_GLES2_EXPORT GLES2CmdHelper : public CommandBufferHelper {
  public:
   explicit GLES2CmdHelper(CommandBuffer* command_buffer);
   ~GLES2CmdHelper() override;
diff --git a/gpu/command_buffer/common/BUILD.gn b/gpu/command_buffer/common/BUILD.gn
index 2262fda..eec7989 100644
--- a/gpu/command_buffer/common/BUILD.gn
+++ b/gpu/command_buffer/common/BUILD.gn
@@ -22,7 +22,7 @@
 group("gles2") {
   if (is_component_build) {
     public_deps = [
-      "//gpu",
+      "//gpu:gles2",
     ]
   } else {
     public_deps = [
@@ -103,14 +103,14 @@
     "gles2_cmd_ids_autogen.h",
   ]
 
-  configs += [ "//gpu:gpu_implementation" ]
+  configs += [ "//gpu:gpu_gles2_implementation" ]
 
   deps = [
     ":gles2_utils",
     "//base",
   ]
   public_deps = [
-    ":common_sources",
+    ":common",
   ]
 }
 
diff --git a/gpu/command_buffer/common/debug_marker_manager.h b/gpu/command_buffer/common/debug_marker_manager.h
index 810352c..6d8b1a771 100644
--- a/gpu/command_buffer/common/debug_marker_manager.h
+++ b/gpu/command_buffer/common/debug_marker_manager.h
@@ -8,13 +8,13 @@
 #include <string>
 
 #include "base/containers/stack.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
 
 // Tracks debug marker.
-class GPU_EXPORT DebugMarkerManager {
+class GPU_GLES2_EXPORT DebugMarkerManager {
  public:
    DebugMarkerManager();
    ~DebugMarkerManager();
diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn
index 4efedd9..d8f56fd 100644
--- a/gpu/command_buffer/service/BUILD.gn
+++ b/gpu/command_buffer/service/BUILD.gn
@@ -20,7 +20,7 @@
 group("gles2") {
   if (is_component_build) {
     public_deps = [
-      "//gpu",
+      "//gpu:gles2",
     ]
   } else {
     public_deps = [
@@ -41,10 +41,13 @@
 
   sources = [
     "async_api_interface.h",
+    "command_buffer_direct.cc",
+    "command_buffer_direct.h",
     "command_buffer_service.cc",
     "command_buffer_service.h",
     "common_decoder.cc",
     "common_decoder.h",
+    "decoder_client.h",
     "gpu_preferences.cc",
     "gpu_preferences.h",
     "gpu_switches.cc",
@@ -106,15 +109,12 @@
     "buffer_manager.cc",
     "buffer_manager.h",
     "client_service_map.h",
-    "command_buffer_direct.cc",
-    "command_buffer_direct.h",
     "context_group.cc",
     "context_group.h",
     "context_state.cc",
     "context_state.h",
     "context_state_autogen.h",
     "context_state_impl_autogen.h",
-    "decoder_client.h",
     "decoder_context.h",
     "error_state.cc",
     "error_state.h",
@@ -215,7 +215,7 @@
 
   configs += [
     "//build/config:precompiled_headers",
-    "//gpu:gpu_implementation",
+    "//gpu:gpu_gles2_implementation",
     "//third_party/khronos:khronos_headers",
   ]
 
@@ -223,18 +223,18 @@
   include_dirs = [ "//third_party/mesa/src/include" ]
 
   public_deps = [
-    "//gpu/command_buffer/common:common_sources",
+    "//gpu/command_buffer/common",
     "//gpu/command_buffer/common:gles2_sources",
   ]
   deps = [
     ":disk_cache_proto",
-    ":service_sources",
+    ":service",
     "//base",
     "//base/third_party/dynamic_annotations",
     "//cc/paint",
-    "//gpu/command_buffer/client:client_sources",
+    "//gpu/command_buffer/client",
     "//gpu/command_buffer/common:gles2_utils",
-    "//gpu/config:config_sources",
+    "//gpu/config",
     "//gpu/ipc/common:surface_handle_type",
     "//third_party/angle:angle_image_util",
     "//third_party/angle:commit_id",
diff --git a/gpu/command_buffer/service/buffer_manager.h b/gpu/command_buffer/service/buffer_manager.h
index d32f37a1b..7b754cf 100644
--- a/gpu/command_buffer/service/buffer_manager.h
+++ b/gpu/command_buffer/service/buffer_manager.h
@@ -20,7 +20,7 @@
 #include "gpu/command_buffer/common/buffer.h"
 #include "gpu/command_buffer/service/gl_utils.h"
 #include "gpu/command_buffer/service/memory_tracking.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -33,7 +33,7 @@
 class TestHelper;
 
 // Info about Buffers currently in the system.
-class GPU_EXPORT Buffer : public base::RefCounted<Buffer> {
+class GPU_GLES2_EXPORT Buffer : public base::RefCounted<Buffer> {
  public:
   struct MappedRange {
     GLintptr offset;
@@ -215,7 +215,8 @@
 //
 // NOTE: To support shared resources an instance of this class will need to be
 // shared by multiple GLES2Decoders.
-class GPU_EXPORT BufferManager : public base::trace_event::MemoryDumpProvider {
+class GPU_GLES2_EXPORT BufferManager
+    : public base::trace_event::MemoryDumpProvider {
  public:
   BufferManager(MemoryTracker* memory_tracker, FeatureInfo* feature_info);
   ~BufferManager() override;
diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h
index bfb0ba54..3829eeac 100644
--- a/gpu/command_buffer/service/context_group.h
+++ b/gpu/command_buffer/service/context_group.h
@@ -22,7 +22,7 @@
 #include "gpu/command_buffer/service/gpu_preferences.h"
 #include "gpu/command_buffer/service/shader_translator_cache.h"
 #include "gpu/config/gpu_feature_info.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -56,7 +56,7 @@
 
 // A Context Group helps manage multiple DecoderContexts that share
 // resources.
-class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> {
+class GPU_GLES2_EXPORT ContextGroup : public base::RefCounted<ContextGroup> {
  public:
   ContextGroup(const GpuPreferences& gpu_preferences,
                bool supports_passthrough_command_decoders,
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h
index bdb1a86..6a0712b6 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -17,7 +17,7 @@
 #include "gpu/command_buffer/service/texture_manager.h"
 #include "gpu/command_buffer/service/vertex_array_manager.h"
 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -33,7 +33,7 @@
 class TransformFeedback;
 
 // State associated with each texture unit.
-struct GPU_EXPORT TextureUnit {
+struct GPU_GLES2_EXPORT TextureUnit {
   TextureUnit();
   TextureUnit(const TextureUnit& other);
   ~TextureUnit();
@@ -140,7 +140,7 @@
   }
 };
 
-class GPU_EXPORT Vec4 {
+class GPU_GLES2_EXPORT Vec4 {
  public:
   Vec4() {
     v_[0].float_value = 0.0f;
@@ -174,20 +174,20 @@
 };
 
 template <>
-GPU_EXPORT void Vec4::GetValues<GLfloat>(GLfloat* values) const;
+GPU_GLES2_EXPORT void Vec4::GetValues<GLfloat>(GLfloat* values) const;
 template <>
-GPU_EXPORT void Vec4::GetValues<GLint>(GLint* values) const;
+GPU_GLES2_EXPORT void Vec4::GetValues<GLint>(GLint* values) const;
 template <>
-GPU_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const;
+GPU_GLES2_EXPORT void Vec4::GetValues<GLuint>(GLuint* values) const;
 
 template <>
-GPU_EXPORT void Vec4::SetValues<GLfloat>(const GLfloat* values);
+GPU_GLES2_EXPORT void Vec4::SetValues<GLfloat>(const GLfloat* values);
 template <>
-GPU_EXPORT void Vec4::SetValues<GLint>(const GLint* values);
+GPU_GLES2_EXPORT void Vec4::SetValues<GLint>(const GLint* values);
 template <>
-GPU_EXPORT void Vec4::SetValues<GLuint>(const GLuint* values);
+GPU_GLES2_EXPORT void Vec4::SetValues<GLuint>(const GLuint* values);
 
-struct GPU_EXPORT ContextState {
+struct GPU_GLES2_EXPORT ContextState {
   enum Dimension {
     k2D,
     k3D
diff --git a/gpu/command_buffer/service/decoder_context.h b/gpu/command_buffer/service/decoder_context.h
index d960712..03939895f 100644
--- a/gpu/command_buffer/service/decoder_context.h
+++ b/gpu/command_buffer/service/decoder_context.h
@@ -16,7 +16,7 @@
 #include "gpu/command_buffer/common/constants.h"
 #include "gpu/command_buffer/common/context_result.h"
 #include "gpu/command_buffer/service/async_api_interface.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gl {
 class GLContext;
@@ -40,7 +40,7 @@
 // Abstract interface implemented by {Raster,GLES2}Decoder. It is called a
 // DecoderContext because all methods are about decoding commands or
 // accessing context/state generated by decoded commands.
-class GPU_EXPORT DecoderContext : public AsyncAPIInterface {
+class GPU_GLES2_EXPORT DecoderContext : public AsyncAPIInterface {
  public:
   DecoderContext() = default;
   ~DecoderContext() override = default;
diff --git a/gpu/command_buffer/service/error_state.h b/gpu/command_buffer/service/error_state.h
index 9681565..3f91eaf 100644
--- a/gpu/command_buffer/service/error_state.h
+++ b/gpu/command_buffer/service/error_state.h
@@ -11,7 +11,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -57,14 +57,14 @@
 #define ERRORSTATE_CLEAR_REAL_GL_ERRORS(error_state, function_name) \
     error_state->ClearRealGLErrors(__FILE__, __LINE__, function_name)
 
-class GPU_EXPORT ErrorStateClient {
+class GPU_GLES2_EXPORT ErrorStateClient {
  public:
   virtual void OnContextLostError() = 0;
   // GL_OUT_OF_MEMORY can cause side effects such as losing the context.
   virtual void OnOutOfMemoryError() = 0;
 };
 
-class GPU_EXPORT ErrorState {
+class GPU_GLES2_EXPORT ErrorState {
  public:
   virtual ~ErrorState();
 
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h
index 24e2c75b..2548add 100644
--- a/gpu/command_buffer/service/feature_info.h
+++ b/gpu/command_buffer/service/feature_info.h
@@ -14,7 +14,7 @@
 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
 #include "gpu/config/gpu_driver_bug_workarounds.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "ui/gl/extension_set.h"
 
 namespace base {
@@ -29,7 +29,7 @@
 namespace gles2 {
 
 // FeatureInfo records the features that are available for a ContextGroup.
-class GPU_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> {
+class GPU_GLES2_EXPORT FeatureInfo : public base::RefCounted<FeatureInfo> {
  public:
   struct FeatureFlags {
     FeatureFlags();
diff --git a/gpu/command_buffer/service/framebuffer_completeness_cache.h b/gpu/command_buffer/service/framebuffer_completeness_cache.h
index dd26bf69..05be906b 100644
--- a/gpu/command_buffer/service/framebuffer_completeness_cache.h
+++ b/gpu/command_buffer/service/framebuffer_completeness_cache.h
@@ -9,7 +9,7 @@
 
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -17,7 +17,7 @@
 // Refcounted wrapper for a hash_set of framebuffer format signatures
 // representing framebuffer configurations that are reported by the GL
 // driver as complete according to glCheckFramebufferStatusEXT.
-class GPU_EXPORT FramebufferCompletenessCache {
+class GPU_GLES2_EXPORT FramebufferCompletenessCache {
  public:
   FramebufferCompletenessCache();
   ~FramebufferCompletenessCache();
diff --git a/gpu/command_buffer/service/framebuffer_manager.h b/gpu/command_buffer/service/framebuffer_manager.h
index 7cef4d19..2629731 100644
--- a/gpu/command_buffer/service/framebuffer_manager.h
+++ b/gpu/command_buffer/service/framebuffer_manager.h
@@ -17,7 +17,7 @@
 #include "gpu/command_buffer/service/context_group.h"
 #include "gpu/command_buffer/service/gl_utils.h"
 #include "gpu/command_buffer/service/shader_manager.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -31,7 +31,7 @@
 class TextureManager;
 
 // Info about a particular Framebuffer.
-class GPU_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
+class GPU_GLES2_EXPORT Framebuffer : public base::RefCounted<Framebuffer> {
  public:
   class Attachment : public base::RefCounted<Attachment> {
    public:
@@ -320,7 +320,7 @@
 
 // This class keeps track of the frambebuffers and their attached renderbuffers
 // so we can correctly clear them.
-class GPU_EXPORT FramebufferManager {
+class GPU_GLES2_EXPORT FramebufferManager {
  public:
   FramebufferManager(
       uint32_t max_draw_buffers,
diff --git a/gpu/command_buffer/service/gl_context_virtual.h b/gpu/command_buffer/service/gl_context_virtual.h
index 6453333a..7b4c299c 100644
--- a/gpu/command_buffer/service/gl_context_virtual.h
+++ b/gpu/command_buffer/service/gl_context_virtual.h
@@ -10,7 +10,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "ui/gl/gl_context.h"
 
 namespace gl {
@@ -23,7 +23,7 @@
 class DecoderContext;
 
 // Encapsulates a virtual OpenGL context.
-class GPU_EXPORT GLContextVirtual : public gl::GLContext {
+class GPU_GLES2_EXPORT GLContextVirtual : public gl::GLContext {
  public:
   GLContextVirtual(gl::GLShareGroup* share_group,
                    gl::GLContext* shared_context,
diff --git a/gpu/command_buffer/service/gl_state_restorer_impl.h b/gpu/command_buffer/service/gl_state_restorer_impl.h
index 082d526..be490a7 100644
--- a/gpu/command_buffer/service/gl_state_restorer_impl.h
+++ b/gpu/command_buffer/service/gl_state_restorer_impl.h
@@ -10,7 +10,7 @@
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "ui/gl/gl_state_restorer.h"
 
 namespace gpu {
@@ -22,7 +22,7 @@
 }
 
 // This class implements a GLStateRestorer that forwards to a DecoderContext.
-class GPU_EXPORT GLStateRestorerImpl : public gl::GLStateRestorer {
+class GPU_GLES2_EXPORT GLStateRestorerImpl : public gl::GLStateRestorer {
  public:
   explicit GLStateRestorerImpl(base::WeakPtr<DecoderContext> decoder);
   ~GLStateRestorerImpl() override;
diff --git a/gpu/command_buffer/service/gl_stream_texture_image.h b/gpu/command_buffer/service/gl_stream_texture_image.h
index 8fb647a..3fdf673 100644
--- a/gpu/command_buffer/service/gl_stream_texture_image.h
+++ b/gpu/command_buffer/service/gl_stream_texture_image.h
@@ -5,7 +5,7 @@
 #ifndef GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_
 #define GPU_COMMAND_BUFFER_SERVICE_GL_STREAM_TEXTURE_IMAGE_H_
 
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "ui/gl/gl_image.h"
 
 namespace gpu {
@@ -13,7 +13,7 @@
 
 // Specialization of GLImage that allows us to support (stream) textures
 // that supply a texture matrix.
-class GPU_EXPORT GLStreamTextureImage : public gl::GLImage {
+class GPU_GLES2_EXPORT GLStreamTextureImage : public gl::GLImage {
  public:
   // Get the matrix.
   // Copy the texture matrix for this image into |matrix|.
diff --git a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.h b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.h
index 9f2bd9ae..33bade3 100644
--- a/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.h
+++ b/gpu/command_buffer/service/gles2_cmd_apply_framebuffer_attachment_cmaa_intel.h
@@ -6,7 +6,7 @@
 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_APPLY_FRAMEBUFFER_ATTACHMENT_CMAA_INTEL_H_
 
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -22,7 +22,7 @@
 // all color attachments of the currently bound draw framebuffer.
 //
 // Reference GL_INTEL_framebuffer_CMAA for details.
-class GPU_EXPORT ApplyFramebufferAttachmentCMAAINTELResourceManager {
+class GPU_GLES2_EXPORT ApplyFramebufferAttachmentCMAAINTELResourceManager {
  public:
   ApplyFramebufferAttachmentCMAAINTELResourceManager();
   ~ApplyFramebufferAttachmentCMAAINTELResourceManager();
diff --git a/gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h b/gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h
index 403d229..7896f1e5 100644
--- a/gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h
+++ b/gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h
@@ -7,7 +7,7 @@
 
 #include "base/macros.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gfx {
 class Size;
@@ -17,7 +17,7 @@
 namespace gles2 {
 class GLES2Decoder;
 
-class GPU_EXPORT ClearFramebufferResourceManager {
+class GPU_GLES2_EXPORT ClearFramebufferResourceManager {
  public:
   ClearFramebufferResourceManager(const gles2::GLES2Decoder* decoder);
   ~ClearFramebufferResourceManager();
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_tex_image.h b/gpu/command_buffer/service/gles2_cmd_copy_tex_image.h
index eaf574e..15d44a9 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_tex_image.h
+++ b/gpu/command_buffer/service/gles2_cmd_copy_tex_image.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "gpu/command_buffer/service/feature_info.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -21,7 +21,7 @@
 // This class encapsulates the resources required to implement the
 // glCopyTexImage and glCopyTexSubImage commands.  These commands somtimes
 // require a blit.
-class GPU_EXPORT CopyTexImageResourceManager {
+class GPU_GLES2_EXPORT CopyTexImageResourceManager {
  public:
   explicit CopyTexImageResourceManager(const gles2::FeatureInfo* feature_info);
   ~CopyTexImageResourceManager();
diff --git a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h
index 95e5063..e17b29e 100644
--- a/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h
+++ b/gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "gpu/command_buffer/service/feature_info.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -44,7 +44,7 @@
 // GL_CHROMIUM_copy_texture extension.  The copy operation is performed
 // via glCopyTexImage2D() or a blit to a framebuffer object.
 // The target of |dest_id| texture must be GL_TEXTURE_2D.
-class GPU_EXPORT CopyTextureCHROMIUMResourceManager {
+class GPU_GLES2_EXPORT CopyTextureCHROMIUMResourceManager {
  public:
   CopyTextureCHROMIUMResourceManager();
   ~CopyTextureCHROMIUMResourceManager();
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.h b/gpu/command_buffer/service/gles2_cmd_decoder.h
index 80e4d6d..fdf10c2 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.h
@@ -24,7 +24,7 @@
 #include "gpu/command_buffer/common/context_result.h"
 #include "gpu/command_buffer/service/common_decoder.h"
 #include "gpu/command_buffer/service/decoder_context.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gl {
 class GLSurface;
@@ -77,7 +77,8 @@
 
 // This class implements the DecoderContext interface, decoding GLES2
 // commands and calling GL.
-class GPU_EXPORT GLES2Decoder : public CommonDecoder, public DecoderContext {
+class GPU_GLES2_EXPORT GLES2Decoder : public CommonDecoder,
+                                      public DecoderContext {
  public:
   typedef error::Error Error;
 
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
index 12c3feb3..7e5b104 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_passthrough.h
@@ -107,7 +107,7 @@
   GLint texture_;
 };
 
-class GPU_EXPORT GLES2DecoderPassthroughImpl : public GLES2Decoder {
+class GPU_GLES2_EXPORT GLES2DecoderPassthroughImpl : public GLES2Decoder {
  public:
   GLES2DecoderPassthroughImpl(DecoderClient* client,
                               CommandBufferServiceBase* command_buffer_service,
diff --git a/gpu/command_buffer/service/gles2_cmd_srgb_converter.h b/gpu/command_buffer/service/gles2_cmd_srgb_converter.h
index 2a19fa9..db39a96 100644
--- a/gpu/command_buffer/service/gles2_cmd_srgb_converter.h
+++ b/gpu/command_buffer/service/gles2_cmd_srgb_converter.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "gpu/command_buffer/service/feature_info.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -21,7 +21,7 @@
 // This class encapsulates the resources required to implement the
 // glBlitFramebuffer command, which somtimes requires to convert sRGB
 // to linear (RGBA) color format, or vice versa.
-class GPU_EXPORT SRGBConverter {
+class GPU_GLES2_EXPORT SRGBConverter {
  public:
   explicit SRGBConverter(const gles2::FeatureInfo* feature_info);
   ~SRGBConverter();
diff --git a/gpu/command_buffer/service/gpu_fence_manager.h b/gpu/command_buffer/service/gpu_fence_manager.h
index acb3a40..c6e03a8 100644
--- a/gpu/command_buffer/service/gpu_fence_manager.h
+++ b/gpu/command_buffer/service/gpu_fence_manager.h
@@ -10,7 +10,7 @@
 
 #include "base/containers/flat_map.h"
 #include "base/macros.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gfx {
 struct GpuFenceHandle;
@@ -26,8 +26,8 @@
 
 // This class keeps track of GpuFence objects and their state. As GpuFence
 // objects are not shared there is one GpuFenceManager per context.
-class GPU_EXPORT GpuFenceManager {
-  class GPU_EXPORT GpuFenceEntry {
+class GPU_GLES2_EXPORT GpuFenceManager {
+  class GPU_GLES2_EXPORT GpuFenceEntry {
    public:
     GpuFenceEntry();
     ~GpuFenceEntry();
diff --git a/gpu/command_buffer/service/gpu_switches.h b/gpu/command_buffer/service/gpu_switches.h
index d1c23e6a..6674fad 100644
--- a/gpu/command_buffer/service/gpu_switches.h
+++ b/gpu/command_buffer/service/gpu_switches.h
@@ -13,8 +13,8 @@
 namespace gpu {
 
 // The command decoder names that can be passed to --use-cmd-decoder.
-extern const char kCmdDecoderValidatingName[];
-extern const char kCmdDecoderPassthroughName[];
+GPU_EXPORT extern const char kCmdDecoderValidatingName[];
+GPU_EXPORT extern const char kCmdDecoderPassthroughName[];
 }  // namespace gpu
 
 namespace switches {
diff --git a/gpu/command_buffer/service/gpu_tracer.h b/gpu/command_buffer/service/gpu_tracer.h
index 423ece7b..79de329 100644
--- a/gpu/command_buffer/service/gpu_tracer.h
+++ b/gpu/command_buffer/service/gpu_tracer.h
@@ -17,7 +17,7 @@
 #include "base/macros.h"
 #include "base/threading/thread.h"
 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gl {
 class GPUTimingClient;
@@ -53,7 +53,7 @@
 };
 
 // Traces GPU Commands.
-class GPU_EXPORT GPUTracer {
+class GPU_GLES2_EXPORT GPUTracer {
  public:
   explicit GPUTracer(GLES2Decoder* decoder);
   virtual ~GPUTracer();
@@ -103,7 +103,7 @@
   DISALLOW_COPY_AND_ASSIGN(GPUTracer);
 };
 
-class GPU_EXPORT Outputter {
+class GPU_GLES2_EXPORT Outputter {
  public:
   virtual ~Outputter() = default;
 
@@ -122,7 +122,7 @@
                                const std::string& name) = 0;
 };
 
-class GPU_EXPORT TraceOutputter : public Outputter {
+class GPU_GLES2_EXPORT TraceOutputter : public Outputter {
  public:
   TraceOutputter();
   explicit TraceOutputter(const std::string& name);
@@ -152,8 +152,7 @@
   DISALLOW_COPY_AND_ASSIGN(TraceOutputter);
 };
 
-class GPU_EXPORT GPUTrace
-    : public base::RefCounted<GPUTrace> {
+class GPU_GLES2_EXPORT GPUTrace : public base::RefCounted<GPUTrace> {
  public:
   GPUTrace(Outputter* outputter,
            gl::GPUTimingClient* gpu_timing_client,
diff --git a/gpu/command_buffer/service/id_manager.h b/gpu/command_buffer/service/id_manager.h
index 7afb5fd..b855282 100644
--- a/gpu/command_buffer/service/id_manager.h
+++ b/gpu/command_buffer/service/id_manager.h
@@ -8,7 +8,7 @@
 #include "base/containers/hash_tables.h"
 #include "base/macros.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -17,7 +17,7 @@
 //
 // NOTE: To support shared resources an instance of this class will
 // need to be shared by multiple GLES2Decoders.
-class GPU_EXPORT IdManager {
+class GPU_GLES2_EXPORT IdManager {
  public:
   IdManager();
   ~IdManager();
diff --git a/gpu/command_buffer/service/indexed_buffer_binding_host.h b/gpu/command_buffer/service/indexed_buffer_binding_host.h
index 18175b8..86c78ffd 100644
--- a/gpu/command_buffer/service/indexed_buffer_binding_host.h
+++ b/gpu/command_buffer/service/indexed_buffer_binding_host.h
@@ -9,7 +9,7 @@
 
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -19,8 +19,8 @@
 // This is a base class for indexed buffer bindings tracking.
 // TransformFeedback and Program should inherit from this base class,
 // for tracking indexed TRANSFORM_FEEDBACK_BUFFER / UNIFORM_BUFFER bindings.
-class GPU_EXPORT IndexedBufferBindingHost :
-    public base::RefCounted<IndexedBufferBindingHost> {
+class GPU_GLES2_EXPORT IndexedBufferBindingHost
+    : public base::RefCounted<IndexedBufferBindingHost> {
  public:
   // In theory |needs_emulation| needs to be true on Desktop GL 4.1 or lower.
   // However, we set it to true everywhere, not to trust drivers to handle
diff --git a/gpu/command_buffer/service/logger.h b/gpu/command_buffer/service/logger.h
index c6eb167..af907b9 100644
--- a/gpu/command_buffer/service/logger.h
+++ b/gpu/command_buffer/service/logger.h
@@ -13,7 +13,7 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -23,7 +23,7 @@
 
 class DebugMarkerManager;
 
-class GPU_EXPORT Logger {
+class GPU_GLES2_EXPORT Logger {
  public:
   static const int kMaxLogMessages = 256;
 
diff --git a/gpu/command_buffer/service/mailbox_manager_factory.h b/gpu/command_buffer/service/mailbox_manager_factory.h
index 87bd888..a448c55 100644
--- a/gpu/command_buffer/service/mailbox_manager_factory.h
+++ b/gpu/command_buffer/service/mailbox_manager_factory.h
@@ -6,7 +6,7 @@
 #define GPU_COMMAND_BUFFER_SERVICE_MAILBOX_MANAGER_FACTORY_H_
 
 #include "gpu/command_buffer/service/mailbox_manager.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -14,7 +14,7 @@
 
 namespace gles2 {
 
-std::unique_ptr<MailboxManager> GPU_EXPORT
+std::unique_ptr<MailboxManager> GPU_GLES2_EXPORT
 CreateMailboxManager(const GpuPreferences& gpu_preferences);
 
 }  // namespace gles2
diff --git a/gpu/command_buffer/service/mailbox_manager_impl.h b/gpu/command_buffer/service/mailbox_manager_impl.h
index cb31003..ec668302 100644
--- a/gpu/command_buffer/service/mailbox_manager_impl.h
+++ b/gpu/command_buffer/service/mailbox_manager_impl.h
@@ -13,13 +13,13 @@
 #include "gpu/command_buffer/common/constants.h"
 #include "gpu/command_buffer/common/mailbox.h"
 #include "gpu/command_buffer/service/mailbox_manager.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
 
 // Manages resources scoped beyond the context or context group level.
-class GPU_EXPORT MailboxManagerImpl : public MailboxManager {
+class GPU_GLES2_EXPORT MailboxManagerImpl : public MailboxManager {
  public:
   MailboxManagerImpl();
   ~MailboxManagerImpl() override;
diff --git a/gpu/command_buffer/service/mailbox_manager_sync.h b/gpu/command_buffer/service/mailbox_manager_sync.h
index 33f4e36..48275fa 100644
--- a/gpu/command_buffer/service/mailbox_manager_sync.h
+++ b/gpu/command_buffer/service/mailbox_manager_sync.h
@@ -16,7 +16,7 @@
 #include "gpu/command_buffer/service/mailbox_manager.h"
 #include "gpu/command_buffer/service/texture_definition.h"
 #include "gpu/command_buffer/service/texture_manager.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -24,7 +24,7 @@
 // Manages resources scoped beyond the context or context group level
 // and across threads and driver level share groups by synchronizing
 // texture state.
-class GPU_EXPORT MailboxManagerSync : public MailboxManager {
+class GPU_GLES2_EXPORT MailboxManagerSync : public MailboxManager {
  public:
   MailboxManagerSync();
   ~MailboxManagerSync() override;
diff --git a/gpu/command_buffer/service/memory_program_cache.h b/gpu/command_buffer/service/memory_program_cache.h
index c138fed..04e4584 100644
--- a/gpu/command_buffer/service/memory_program_cache.h
+++ b/gpu/command_buffer/service/memory_program_cache.h
@@ -25,7 +25,7 @@
 namespace gles2 {
 
 // Program cache that stores binaries completely in-memory
-class GPU_EXPORT MemoryProgramCache : public ProgramCache {
+class GPU_GLES2_EXPORT MemoryProgramCache : public ProgramCache {
  public:
   MemoryProgramCache(size_t max_cache_size_bytes,
                      bool disable_gpu_shader_disk_cache,
diff --git a/gpu/command_buffer/service/passthrough_program_cache.h b/gpu/command_buffer/service/passthrough_program_cache.h
index 87f583d..dca1dd9b 100644
--- a/gpu/command_buffer/service/passthrough_program_cache.h
+++ b/gpu/command_buffer/service/passthrough_program_cache.h
@@ -15,7 +15,7 @@
 
 // Program cache that does not store binaries, but communicates with the
 // underlying implementation via the cache control extension.
-class GPU_EXPORT PassthroughProgramCache : public ProgramCache {
+class GPU_GLES2_EXPORT PassthroughProgramCache : public ProgramCache {
  public:
   PassthroughProgramCache(size_t max_cache_size_bytes,
                           bool disable_gpu_shader_disk_cache);
diff --git a/gpu/command_buffer/service/path_manager.h b/gpu/command_buffer/service/path_manager.h
index d334a860..840f621 100644
--- a/gpu/command_buffer/service/path_manager.h
+++ b/gpu/command_buffer/service/path_manager.h
@@ -9,14 +9,14 @@
 
 #include "base/macros.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
 
 // This class keeps track of paths and their client and service ids
 // so we can correctly clear them.
-class GPU_EXPORT PathManager {
+class GPU_GLES2_EXPORT PathManager {
  public:
   PathManager();
   ~PathManager();
diff --git a/gpu/command_buffer/service/program_cache.h b/gpu/command_buffer/service/program_cache.h
index 45b2f6e1..dc21756 100644
--- a/gpu/command_buffer/service/program_cache.h
+++ b/gpu/command_buffer/service/program_cache.h
@@ -24,7 +24,7 @@
 class Shader;
 
 // Program cache base class for caching linked gpu programs
-class GPU_EXPORT ProgramCache {
+class GPU_GLES2_EXPORT ProgramCache {
  public:
   static const size_t kHashLength = base::kSHA1Length;
 
diff --git a/gpu/command_buffer/service/program_manager.h b/gpu/command_buffer/service/program_manager.h
index 841091ca..cbd2f02 100644
--- a/gpu/command_buffer/service/program_manager.h
+++ b/gpu/command_buffer/service/program_manager.h
@@ -19,7 +19,7 @@
 #include "gpu/command_buffer/service/common_decoder.h"
 #include "gpu/command_buffer/service/gl_utils.h"
 #include "gpu/command_buffer/service/shader_manager.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -38,7 +38,7 @@
 // This is used to track which attributes a particular program needs
 // so we can verify at glDrawXXX time that every attribute is either disabled
 // or if enabled that it points to a valid source.
-class GPU_EXPORT Program : public base::RefCounted<Program> {
+class GPU_GLES2_EXPORT Program : public base::RefCounted<Program> {
  public:
   static const int kMaxAttachedShaders = 2;
 
@@ -642,7 +642,7 @@
 //
 // NOTE: To support shared resources an instance of this class will
 // need to be shared by multiple GLES2Decoders.
-class GPU_EXPORT ProgramManager {
+class GPU_GLES2_EXPORT ProgramManager {
  public:
   ProgramManager(ProgramCache* program_cache,
                  uint32_t max_varying_vectors,
diff --git a/gpu/command_buffer/service/progress_reporter.h b/gpu/command_buffer/service/progress_reporter.h
index 14d57b6..926e4f8 100644
--- a/gpu/command_buffer/service/progress_reporter.h
+++ b/gpu/command_buffer/service/progress_reporter.h
@@ -5,14 +5,14 @@
 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRESS_REPORTER_H_
 #define GPU_COMMAND_BUFFER_SERVICE_PROGRESS_REPORTER_H_
 
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
 
 // ProgressReporter is used by ContextGroup to report when it is making forward
 // progress in execution, delaying activation of the watchdog timeout.
-class GPU_EXPORT ProgressReporter {
+class GPU_GLES2_EXPORT ProgressReporter {
  public:
   virtual ~ProgressReporter() = default;
 
diff --git a/gpu/command_buffer/service/query_manager.h b/gpu/command_buffer/service/query_manager.h
index ba0c34a..9f7724b 100644
--- a/gpu/command_buffer/service/query_manager.h
+++ b/gpu/command_buffer/service/query_manager.h
@@ -17,7 +17,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/feature_info.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gl {
 class GPUTimer;
@@ -34,9 +34,9 @@
 
 // This class keeps track of the queries and their state
 // As Queries are not shared there is one QueryManager per context.
-class GPU_EXPORT QueryManager {
+class GPU_GLES2_EXPORT QueryManager {
  public:
-  class GPU_EXPORT Query : public base::RefCounted<Query> {
+  class GPU_GLES2_EXPORT Query : public base::RefCounted<Query> {
    public:
     Query(QueryManager* manager,
           GLenum target,
diff --git a/gpu/command_buffer/service/raster_decoder.h b/gpu/command_buffer/service/raster_decoder.h
index 2b148ea..2cabd936 100644
--- a/gpu/command_buffer/service/raster_decoder.h
+++ b/gpu/command_buffer/service/raster_decoder.h
@@ -29,7 +29,7 @@
 #include "gpu/command_buffer/service/feature_info.h"
 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
 #include "gpu/command_buffer/service/logger.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -40,9 +40,9 @@
 
 // This class implements the AsyncAPIInterface interface, decoding
 // RasterInterface commands and calling GL.
-class GPU_EXPORT RasterDecoder : public DecoderContext,
-                                 public CommonDecoder,
-                                 public gles2::ErrorStateClient {
+class GPU_GLES2_EXPORT RasterDecoder : public DecoderContext,
+                                       public CommonDecoder,
+                                       public gles2::ErrorStateClient {
  public:
   RasterDecoder(DecoderClient* client,
                 CommandBufferServiceBase* command_buffer_service,
diff --git a/gpu/command_buffer/service/renderbuffer_manager.h b/gpu/command_buffer/service/renderbuffer_manager.h
index 72373f7..a647c5b5 100644
--- a/gpu/command_buffer/service/renderbuffer_manager.h
+++ b/gpu/command_buffer/service/renderbuffer_manager.h
@@ -17,7 +17,7 @@
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/gl_utils.h"
 #include "gpu/command_buffer/service/memory_tracking.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 class GpuDriverBugWorkarounds;
@@ -29,8 +29,7 @@
 class RenderbufferManager;
 
 // Info about a Renderbuffer.
-class GPU_EXPORT Renderbuffer
-    : public base::RefCounted<Renderbuffer> {
+class GPU_GLES2_EXPORT Renderbuffer : public base::RefCounted<Renderbuffer> {
  public:
   Renderbuffer(RenderbufferManager* manager,
                GLuint client_id,
@@ -146,7 +145,7 @@
 
 // This class keeps track of the renderbuffers and whether or not they have
 // been cleared.
-class GPU_EXPORT RenderbufferManager
+class GPU_GLES2_EXPORT RenderbufferManager
     : public base::trace_event::MemoryDumpProvider {
  public:
   RenderbufferManager(MemoryTracker* memory_tracker,
diff --git a/gpu/command_buffer/service/sampler_manager.h b/gpu/command_buffer/service/sampler_manager.h
index 61c5116..05d2958 100644
--- a/gpu/command_buffer/service/sampler_manager.h
+++ b/gpu/command_buffer/service/sampler_manager.h
@@ -13,7 +13,7 @@
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/feature_info.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -35,7 +35,7 @@
   GLfloat min_lod;
 };
 
-class GPU_EXPORT Sampler : public base::RefCounted<Sampler> {
+class GPU_GLES2_EXPORT Sampler : public base::RefCounted<Sampler> {
  public:
   Sampler(SamplerManager* manager, GLuint client_id, GLuint service_id);
 
@@ -128,7 +128,7 @@
 };
 
 // This class keeps track of the samplers and their state.
-class GPU_EXPORT SamplerManager {
+class GPU_GLES2_EXPORT SamplerManager {
  public:
   SamplerManager(FeatureInfo* feature_info);
   ~SamplerManager();
diff --git a/gpu/command_buffer/service/service_discardable_manager.h b/gpu/command_buffer/service/service_discardable_manager.h
index e415a82..8723bf0 100644
--- a/gpu/command_buffer/service/service_discardable_manager.h
+++ b/gpu/command_buffer/service/service_discardable_manager.h
@@ -11,7 +11,7 @@
 #include "base/memory/memory_pressure_listener.h"
 #include "gpu/command_buffer/common/discardable_handle.h"
 #include "gpu/command_buffer/service/context_group.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -19,7 +19,7 @@
 class TextureRef;
 }
 
-class GPU_EXPORT ServiceDiscardableManager {
+class GPU_GLES2_EXPORT ServiceDiscardableManager {
  public:
   ServiceDiscardableManager();
   ~ServiceDiscardableManager();
diff --git a/gpu/command_buffer/service/service_transfer_cache.h b/gpu/command_buffer/service/service_transfer_cache.h
index ce553934..4cacac1 100644
--- a/gpu/command_buffer/service/service_transfer_cache.h
+++ b/gpu/command_buffer/service/service_transfer_cache.h
@@ -12,7 +12,7 @@
 #include "cc/paint/transfer_cache_entry.h"
 #include "gpu/command_buffer/common/discardable_handle.h"
 #include "gpu/command_buffer/service/context_group.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 
@@ -24,7 +24,7 @@
 // unlocking and deleting entries when no longer needed, as well as enforcing
 // cache limits. If the cache exceeds its specified limits, unlocked transfer
 // cache entries may be deleted.
-class GPU_EXPORT ServiceTransferCache {
+class GPU_GLES2_EXPORT ServiceTransferCache {
  public:
   ServiceTransferCache();
   ~ServiceTransferCache();
diff --git a/gpu/command_buffer/service/service_utils.h b/gpu/command_buffer/service/service_utils.h
index 8514ed0f..589d13b 100644
--- a/gpu/command_buffer/service/service_utils.h
+++ b/gpu/command_buffer/service/service_utils.h
@@ -6,7 +6,7 @@
 #define GPU_COMMAND_BUFFER_SERVICE_SERVICE_UTILS_H_
 
 #include "base/command_line.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "ui/gl/gl_context.h"
 
 namespace gpu {
@@ -15,16 +15,16 @@
 namespace gles2 {
 class ContextGroup;
 
-GPU_EXPORT gl::GLContextAttribs GenerateGLContextAttribs(
+GPU_GLES2_EXPORT gl::GLContextAttribs GenerateGLContextAttribs(
     const ContextCreationAttribs& attribs_helper,
     const ContextGroup* context_group);
 
 // Returns true if the passthrough command decoder has been requested
-GPU_EXPORT bool UsePassthroughCommandDecoder(
+GPU_GLES2_EXPORT bool UsePassthroughCommandDecoder(
     const base::CommandLine* command_line);
 
 // Returns true if the driver supports creating passthrough command decoders
-GPU_EXPORT bool PassthroughCommandDecoderSupported();
+GPU_GLES2_EXPORT bool PassthroughCommandDecoderSupported();
 
 }  // namespace gles2
 }  // namespace gpu
diff --git a/gpu/command_buffer/service/shader_manager.h b/gpu/command_buffer/service/shader_manager.h
index 4df84f0..18c9f11 100644
--- a/gpu/command_buffer/service/shader_manager.h
+++ b/gpu/command_buffer/service/shader_manager.h
@@ -13,7 +13,7 @@
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/gl_utils.h"
 #include "gpu/command_buffer/service/shader_translator.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -31,7 +31,7 @@
 // to emluate GLES2 the shaders will have to be re-written before passed to
 // the underlying OpenGL. But, when the user calls glGetShaderSource they
 // should get the source they passed in, not the re-written source.
-class GPU_EXPORT Shader : public base::RefCounted<Shader> {
+class GPU_GLES2_EXPORT Shader : public base::RefCounted<Shader> {
  public:
   enum TranslatedShaderSourceType {
     kANGLE,
@@ -265,7 +265,7 @@
 //
 // NOTE: To support shared resources an instance of this class will
 // need to be shared by multiple GLES2Decoders.
-class GPU_EXPORT ShaderManager {
+class GPU_GLES2_EXPORT ShaderManager {
  public:
   ShaderManager(ProgressReporter* progress_reporter);
   ~ShaderManager();
diff --git a/gpu/command_buffer/service/shader_translator.h b/gpu/command_buffer/service/shader_translator.h
index eb11dcf..f6f80adb 100644
--- a/gpu/command_buffer/service/shader_translator.h
+++ b/gpu/command_buffer/service/shader_translator.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/observer_list.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "third_party/angle/include/GLSLANG/ShaderLang.h"
 
 namespace gl {
@@ -74,7 +74,7 @@
 };
 
 // Implementation of ShaderTranslatorInterface
-class GPU_EXPORT ShaderTranslator : public ShaderTranslatorInterface {
+class GPU_GLES2_EXPORT ShaderTranslator : public ShaderTranslatorInterface {
  public:
   class DestructionObserver {
    public:
diff --git a/gpu/command_buffer/service/shader_translator_cache.h b/gpu/command_buffer/service/shader_translator_cache.h
index 391ff34a..ffc2bab3 100644
--- a/gpu/command_buffer/service/shader_translator_cache.h
+++ b/gpu/command_buffer/service/shader_translator_cache.h
@@ -27,7 +27,7 @@
 //
 // TODO(backer): Investigate using glReleaseShaderCompiler as an alternative to
 // to this cache.
-class GPU_EXPORT ShaderTranslatorCache
+class GPU_GLES2_EXPORT ShaderTranslatorCache
     : public ShaderTranslator::DestructionObserver {
  public:
   explicit ShaderTranslatorCache(const GpuPreferences& gpu_preferences);
diff --git a/gpu/command_buffer/service/texture_manager.h b/gpu/command_buffer/service/texture_manager.h
index 6b10aec..fe57445c 100644
--- a/gpu/command_buffer/service/texture_manager.h
+++ b/gpu/command_buffer/service/texture_manager.h
@@ -23,7 +23,7 @@
 #include "gpu/command_buffer/service/memory_tracking.h"
 #include "gpu/command_buffer/service/sampler_manager.h"
 #include "gpu/command_buffer/service/texture_base.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gl/gl_image.h"
 
@@ -74,7 +74,7 @@
 // Info about Textures currently in the system.
 // This class wraps a real GL texture, keeping track of its meta-data. It is
 // jointly owned by possibly multiple TextureRef.
-class GPU_EXPORT Texture final : public TextureBase {
+class GPU_GLES2_EXPORT Texture final : public TextureBase {
  public:
   enum ImageState {
     // If an image is associated with the texture and image state is UNBOUND,
@@ -627,7 +627,7 @@
 // with a client id, though it can outlive the client id if it's still bound to
 // a FBO or another context when destroyed.
 // Multiple TextureRef can point to the same texture with cross-context sharing.
-class GPU_EXPORT TextureRef : public base::RefCounted<TextureRef> {
+class GPU_GLES2_EXPORT TextureRef : public base::RefCounted<TextureRef> {
  public:
   TextureRef(TextureManager* manager, GLuint client_id, Texture* texture);
   static scoped_refptr<TextureRef> Create(TextureManager* manager,
@@ -693,9 +693,10 @@
 //
 // NOTE: To support shared resources an instance of this class will need to be
 // shared by multiple GLES2Decoders.
-class GPU_EXPORT TextureManager : public base::trace_event::MemoryDumpProvider {
+class GPU_GLES2_EXPORT TextureManager
+    : public base::trace_event::MemoryDumpProvider {
  public:
-  class GPU_EXPORT DestructionObserver {
+  class GPU_GLES2_EXPORT DestructionObserver {
    public:
     DestructionObserver();
     virtual ~DestructionObserver();
diff --git a/gpu/command_buffer/service/transform_feedback_manager.h b/gpu/command_buffer/service/transform_feedback_manager.h
index edb5227..09c370e4 100644
--- a/gpu/command_buffer/service/transform_feedback_manager.h
+++ b/gpu/command_buffer/service/transform_feedback_manager.h
@@ -11,7 +11,7 @@
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/gl_utils.h"
 #include "gpu/command_buffer/service/indexed_buffer_binding_host.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -20,7 +20,7 @@
 class TransformFeedbackManager;
 
 // Info about TransformFeedbacks currently in the system.
-class GPU_EXPORT TransformFeedback : public IndexedBufferBindingHost {
+class GPU_GLES2_EXPORT TransformFeedback : public IndexedBufferBindingHost {
  public:
   TransformFeedback(
       TransformFeedbackManager* manager, GLuint client_id, GLuint service_id);
@@ -76,7 +76,7 @@
 };
 
 // This class keeps tracks of the transform feedbacks and their states.
-class GPU_EXPORT TransformFeedbackManager {
+class GPU_GLES2_EXPORT TransformFeedbackManager {
  public:
   // In theory |needs_emulation| needs to be true on Desktop GL 4.1 or lower.
   // However, we set it to true everywhere, not to trust drivers to handle
diff --git a/gpu/command_buffer/service/vertex_array_manager.h b/gpu/command_buffer/service/vertex_array_manager.h
index 8221f30..5ff5649 100644
--- a/gpu/command_buffer/service/vertex_array_manager.h
+++ b/gpu/command_buffer/service/vertex_array_manager.h
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -21,7 +21,7 @@
 
 // This class keeps track of the vertex arrays and their sizes so we can do
 // bounds checking.
-class GPU_EXPORT VertexArrayManager {
+class GPU_GLES2_EXPORT VertexArrayManager {
  public:
   VertexArrayManager();
   ~VertexArrayManager();
diff --git a/gpu/command_buffer/service/vertex_attrib_manager.h b/gpu/command_buffer/service/vertex_attrib_manager.h
index ced1e371..ff54986 100644
--- a/gpu/command_buffer/service/vertex_attrib_manager.h
+++ b/gpu/command_buffer/service/vertex_attrib_manager.h
@@ -15,7 +15,7 @@
 #include "build/build_config.h"
 #include "gpu/command_buffer/service/buffer_manager.h"
 #include "gpu/command_buffer/service/gl_utils.h"
-#include "gpu/gpu_export.h"
+#include "gpu/gpu_gles2_export.h"
 
 namespace gpu {
 namespace gles2 {
@@ -29,7 +29,7 @@
 // Info about a Vertex Attribute. This is used to track what the user currently
 // has bound on each Vertex Attribute so that checking can be done at
 // glDrawXXX time.
-class GPU_EXPORT VertexAttrib {
+class GPU_GLES2_EXPORT VertexAttrib {
  public:
   typedef std::list<VertexAttrib*> VertexAttribList;
 
@@ -180,8 +180,8 @@
 // Manages vertex attributes.
 // This class also acts as the service-side representation of a
 // vertex array object and it's contained state.
-class GPU_EXPORT VertexAttribManager :
-    public base::RefCounted<VertexAttribManager> {
+class GPU_GLES2_EXPORT VertexAttribManager
+    : public base::RefCounted<VertexAttribManager> {
  public:
   typedef std::list<VertexAttrib*> VertexAttribList;
 
diff --git a/gpu/config/BUILD.gn b/gpu/config/BUILD.gn
index f151284..df34075 100644
--- a/gpu/config/BUILD.gn
+++ b/gpu/config/BUILD.gn
@@ -144,6 +144,9 @@
       ]
     }
   }
+  if (is_mac) {
+    libs = [ "OpenGL.framework" ]
+  }
   if (is_linux || is_mac) {
     deps += [ "//third_party/angle:angle_gpu_info_util" ]
   }
diff --git a/gpu/gles2_conform_support/egl/BUILD.gn b/gpu/gles2_conform_support/egl/BUILD.gn
index 622671c..92289196 100644
--- a/gpu/gles2_conform_support/egl/BUILD.gn
+++ b/gpu/gles2_conform_support/egl/BUILD.gn
@@ -31,8 +31,10 @@
     "//base",
     "//gpu",
     "//gpu/command_buffer/client:gles2_c_lib_nocheck",
+    "//gpu/command_buffer/client:gles2_cmd_helper",
     "//gpu/command_buffer/client:gles2_implementation_no_check",
     "//gpu/command_buffer/service",
+    "//gpu/command_buffer/service:gles2",
     "//ui/base",
     "//ui/gfx",
     "//ui/gfx/geometry",
diff --git a/gpu/gpu_gles2_export.h b/gpu/gpu_gles2_export.h
new file mode 100644
index 0000000..cf7d3b4
--- /dev/null
+++ b/gpu/gpu_gles2_export.h
@@ -0,0 +1,29 @@
+// Copyright 2018 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 GPU_GPU_GLES2_EXPORT_H_
+#define GPU_GPU_GLES2_EXPORT_H_
+
+#if defined(COMPONENT_BUILD) && !defined(NACL_WIN64)
+#if defined(WIN32)
+
+#if defined(GPU_GLES2_IMPLEMENTATION)
+#define GPU_GLES2_EXPORT __declspec(dllexport)
+#else
+#define GPU_GLES2_EXPORT __declspec(dllimport)
+#endif  // defined(GPU_GLES2_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#if defined(GPU_GLES2_IMPLEMENTATION)
+#define GPU_GLES2_EXPORT __attribute__((visibility("default")))
+#else
+#define GPU_GLES2_EXPORT
+#endif
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define GPU_GLES2_EXPORT
+#endif
+
+#endif  // GPU_GPU_GLES2_EXPORT_H_
diff --git a/gpu/ipc/client/BUILD.gn b/gpu/ipc/client/BUILD.gn
index 893723183..7821893 100644
--- a/gpu/ipc/client/BUILD.gn
+++ b/gpu/ipc/client/BUILD.gn
@@ -32,6 +32,7 @@
       "gpu_memory_buffer_impl_io_surface.cc",
       "gpu_memory_buffer_impl_io_surface.h",
     ]
+    libs = [ "IOSurface.framework" ]
   }
   if (is_win) {
     sources += [
diff --git a/media/gpu/BUILD.gn b/media/gpu/BUILD.gn
index c129c5a..ecd72bd 100644
--- a/media/gpu/BUILD.gn
+++ b/media/gpu/BUILD.gn
@@ -162,6 +162,7 @@
     "//ui/gfx/geometry",
   ]
   deps = [
+    "//gpu/command_buffer/service:gles2",
     "//gpu/ipc/service",
     "//ui/base",
     "//ui/display/types",
diff --git a/media/gpu/ipc/service/BUILD.gn b/media/gpu/ipc/service/BUILD.gn
index 5550c3f..812d291 100644
--- a/media/gpu/ipc/service/BUILD.gn
+++ b/media/gpu/ipc/service/BUILD.gn
@@ -34,6 +34,7 @@
     "//media/gpu",
   ]
   deps = [
+    "//gpu/command_buffer/service:gles2",
     "//gpu/ipc/service",
     "//media:media_features",
     "//media/gpu:features",
diff --git a/services/ui/public/cpp/gpu/BUILD.gn b/services/ui/public/cpp/gpu/BUILD.gn
index d8e7c0b..d761ff6 100644
--- a/services/ui/public/cpp/gpu/BUILD.gn
+++ b/services/ui/public/cpp/gpu/BUILD.gn
@@ -43,6 +43,7 @@
     "//cc",
     "//gpu",
     "//gpu/command_buffer/client",
+    "//gpu/command_buffer/client:gles2_cmd_helper",
     "//gpu/command_buffer/client:gles2_implementation",
     "//gpu/skia_bindings",
     "//mojo/public/cpp/system",