Enable accelerated WebKit compositor for Aura.

This allows the use of the WebKit compositor for Aura on Linux. It reuses the same display path as TOUCH_UI.

BUG=none
TEST=build GYP_DEFINES="use_aura" on Linux; go to http://www.webkit.org/blog-files/3d-transforms/poster-circle.html

Review URL: http://codereview.chromium.org/8241012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105323 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/build/common.gypi b/build/common.gypi
index 7635514e..512c8e9d 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -327,6 +327,14 @@
           'proprietary_codecs%': 1,
           'enable_webrtc%': 0,
         }],
+
+        # Use GPU accelerated cross process image transport by default
+        # on TOUCH_UI and linux builds with the Aura window manager
+        ['views_compositor==1 and OS=="linux"', {
+          'views_gpu_image_transport%': 1,
+        }, {
+          'views_gpu_image_transport%': 0,
+        }],
       ],
     },
 
@@ -339,6 +347,7 @@
     'toolkit_views%': '<(toolkit_views)',
     'use_only_pure_views%': '<(use_only_pure_views)',
     'views_compositor%': '<(views_compositor)',
+    'views_gpu_image_transport%': '<(views_gpu_image_transport)',
     'use_aura%': '<(use_aura)',
     'use_openssl%': '<(use_openssl)',
     'use_nss%': '<(use_nss)',
@@ -937,6 +946,9 @@
       ['views_compositor==1', {
         'defines': ['VIEWS_COMPOSITOR=1'],
       }],
+      ['views_gpu_image_transport==1', {
+        'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
+      }],
       ['use_aura==1', {
         'defines': ['USE_AURA=1'],
       }],
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc
index 4ad443c5..1a48a378 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc
@@ -37,6 +37,14 @@
 #include "views/widget/tooltip_manager.h"
 #include "views/widget/widget.h"
 
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
+#include "base/bind.h"
+#include "chrome/browser/renderer_host/accelerated_surface_container_touch.h"
+#include "content/browser/gpu/gpu_process_host_ui_shim.h"
+#include "content/common/gpu/gpu_messages.h"
+#include "ui/gfx/gl/gl_bindings.h"
+#endif
+
 #if defined(TOOLKIT_USES_GTK)
 #include <gtk/gtk.h>
 #include <gtk/gtkwindow.h>
@@ -45,10 +53,6 @@
 #include "views/widget/native_widget_gtk.h"
 #endif
 
-#if defined(TOUCH_UI)
-#include "chrome/browser/renderer_host/accelerated_surface_container_touch.h"
-#endif
-
 #if defined(OS_POSIX)
 #include "content/browser/renderer_host/gtk_window_utils.h"
 #endif
@@ -94,6 +98,15 @@
   wmevent->globalY = wmevent->y + origin.y();
 }
 
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
+void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) {
+  // It's possible that gpu_host_id is no longer valid at this point (like if
+  // gpu process was restarted after a crash).  SendToGpuHost handles this.
+  GpuProcessHostUIShim::SendToGpuHost(gpu_host_id,
+      new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
+}
+#endif
+
 }  // namespace
 
 RenderWidgetHostViewViews::RenderWidgetHostViewViews(RenderWidgetHost* host)
@@ -1067,7 +1080,7 @@
 }
 #endif
 
-#if !defined(TOUCH_UI) && !defined(OS_WIN)
+#if !defined(OS_WIN) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
   // TODO(oshima): The original implementation was broken as
   // GtkNativeViewManager doesn't know about NativeWidgetGtk. Figure
@@ -1077,3 +1090,64 @@
   return gfx::kNullPluginWindow;
 }
 #endif
+
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
+gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
+  // On TOUCH_UI builds, the GPU process renders to an offscreen surface
+  // (created by the GPU process), which is later displayed by the browser.
+  // As the GPU process creates this surface, we can return any non-zero value.
+  return 1;
+}
+
+void RenderWidgetHostViewViews::AcceleratedSurfaceNew(
+    int32 width,
+    int32 height,
+    uint64* surface_id,
+    TransportDIB::Handle* surface_handle) {
+  scoped_ptr<AcceleratedSurfaceContainerTouch> surface(
+      AcceleratedSurfaceContainerTouch::CreateAcceleratedSurfaceContainer(
+          gfx::Size(width, height)));
+  if (!surface->Initialize(surface_id)) {
+    LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer";
+    return;
+  }
+  *surface_handle = surface->Handle();
+
+  accelerated_surface_containers_[*surface_id] = surface.release();
+}
+
+void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) {
+  accelerated_surface_containers_.erase(surface_id);
+}
+
+void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped(
+    uint64 surface_id,
+    int32 route_id,
+    int gpu_host_id) {
+  SetExternalTexture(accelerated_surface_containers_[surface_id].get());
+  glFlush();
+
+  if (!GetWidget() || !GetWidget()->GetCompositor()) {
+    // We have no compositor, so we have no way to display the surface
+    AcknowledgeSwapBuffers(route_id, gpu_host_id);  // Must still send the ACK
+  } else {
+    // Add sending an ACK to the list of things to do OnCompositingEnded
+    on_compositing_ended_callbacks_.push_back(
+        base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id));
+    ui::Compositor *compositor = GetWidget()->GetCompositor();
+    if (!compositor->HasObserver(this))
+      compositor->AddObserver(this);
+  }
+}
+
+void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) {
+  for (std::vector< base::Callback<void(void)> >::const_iterator
+      it = on_compositing_ended_callbacks_.begin();
+      it != on_compositing_ended_callbacks_.end(); ++it) {
+    it->Run();
+  }
+  on_compositing_ended_callbacks_.clear();
+  compositor->RemoveObserver(this);
+}
+
+#endif
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.h b/chrome/browser/renderer_host/render_widget_host_view_views.h
index 977fccb..f20c491 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.h
@@ -30,6 +30,9 @@
 namespace ui {
 enum TouchStatus;
 }
+#endif
+
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 class AcceleratedSurfaceContainerTouch;
 #endif
 
@@ -40,7 +43,7 @@
 // See comments in render_widget_host_view.h about this class and its members.
 // -----------------------------------------------------------------------------
 class RenderWidgetHostViewViews : public RenderWidgetHostView,
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
                                   public ui::CompositorObserver,
 #endif
                                   public views::TouchSelectionClientView,
@@ -181,7 +184,7 @@
       base::i18n::TextDirection direction) OVERRIDE;
   virtual views::View* GetOwnerViewOfTextInputClient() OVERRIDE;
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   virtual void AcceleratedSurfaceNew(
       int32 width,
       int32 height,
@@ -294,7 +297,7 @@
 
   string16 tooltip_text_;
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   std::vector< base::Callback<void(void)> > on_compositing_ended_callbacks_;
 #endif
 
@@ -308,6 +311,9 @@
   // used to register for keyboard visiblity notificatons.
   NotificationRegistrar registrar_;
   gfx::Rect keyboard_rect_;
+#endif
+
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   std::map<uint64, scoped_refptr<AcceleratedSurfaceContainerTouch> >
       accelerated_surface_containers_;
 #endif
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc b/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc
index eb013bf..7d61959d 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views_touch.cc
@@ -4,14 +4,9 @@
 
 #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
 
-#include "base/bind.h"
 #include "base/logging.h"
-#include "chrome/browser/renderer_host/accelerated_surface_container_touch.h"
-#include "content/browser/gpu/gpu_process_host_ui_shim.h"
 #include "content/browser/renderer_host/render_widget_host.h"
-#include "content/common/gpu/gpu_messages.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h"
-#include "ui/gfx/gl/gl_bindings.h"
 #include "views/widget/widget.h"
 
 static const char kRenderWidgetHostViewKey[] = "__RENDER_WIDGET_HOST_VIEW__";
@@ -71,13 +66,6 @@
   tpoint->screenPosition.y = tpoint->position.y + origin.y();
 }
 
-void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id) {
-  // It's possible that gpu_host_id is no longer valid at this point (like if
-  // gpu process was restarted after a crash).  SendToGpuHost handles this.
-  GpuProcessHostUIShim::SendToGpuHost(gpu_host_id,
-      new AcceleratedSurfaceMsg_BuffersSwappedACK(route_id));
-}
-
 }  // namespace
 
 ui::TouchStatus RenderWidgetHostViewViews::OnTouchEvent(
@@ -183,62 +171,3 @@
 
   return status;
 }
-
-gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() {
-  // On TOUCH_UI builds, the GPU process renders to an offscreen surface
-  // (created by the GPU process), which is later displayed by the browser.
-  // As the GPU process creates this surface, we can return any non-zero value.
-  return 1;
-}
-
-void RenderWidgetHostViewViews::AcceleratedSurfaceNew(
-    int32 width,
-    int32 height,
-    uint64* surface_id,
-    TransportDIB::Handle* surface_handle) {
-  scoped_ptr<AcceleratedSurfaceContainerTouch> surface(
-      AcceleratedSurfaceContainerTouch::CreateAcceleratedSurfaceContainer(
-          gfx::Size(width, height)));
-  if (!surface->Initialize(surface_id)) {
-    LOG(ERROR) << "Failed to create AcceleratedSurfaceContainer";
-    return;
-  }
-  *surface_handle = surface->Handle();
-
-  accelerated_surface_containers_[*surface_id] = surface.release();
-}
-
-void RenderWidgetHostViewViews::AcceleratedSurfaceRelease(uint64 surface_id) {
-  accelerated_surface_containers_.erase(surface_id);
-}
-
-void RenderWidgetHostViewViews::AcceleratedSurfaceBuffersSwapped(
-    uint64 surface_id,
-    int32 route_id,
-    int gpu_host_id) {
-  SetExternalTexture(accelerated_surface_containers_[surface_id].get());
-  glFlush();
-
-  if (!GetWidget() || !GetWidget()->GetCompositor()) {
-    // We have no compositor, so we have no way to display the surface
-    AcknowledgeSwapBuffers(route_id, gpu_host_id);  // Must still send the ACK
-  } else {
-    // Add sending an ACK to the list of things to do OnCompositingEnded
-    on_compositing_ended_callbacks_.push_back(
-        base::Bind(AcknowledgeSwapBuffers, route_id, gpu_host_id));
-    ui::Compositor *compositor = GetWidget()->GetCompositor();
-    if (!compositor->HasObserver(this))
-      compositor->AddObserver(this);
-  }
-}
-
-void RenderWidgetHostViewViews::OnCompositingEnded(ui::Compositor* compositor) {
-  for (std::vector< base::Callback<void(void)> >::const_iterator
-      it = on_compositing_ended_callbacks_.begin();
-      it != on_compositing_ended_callbacks_.end(); ++it) {
-    it->Run();
-  }
-  on_compositing_ended_callbacks_.clear();
-  compositor->RemoveObserver(this);
-}
-
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ec5a6d4a..6851dd0 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -4069,17 +4069,11 @@
             ['exclude', '^browser/chromeos/login/touch_*'],
             ['exclude', '^browser/extensions/extension_input_ui_api.cc'],
             ['exclude', '^browser/extensions/extension_input_ui_api.h'],
-            ['exclude', '^browser/renderer_host/accelerated_surface_container_touch.cc'],
-            ['exclude', '^browser/renderer_host/accelerated_surface_container_touch.h'],
             ['exclude', '^browser/renderer_host/render_widget_host_view_views_touch.cc'],
             ['exclude', '^browser/ui/touch/*'],
           ],
         }],
         ['touchui==1', {
-          'dependencies': [
-            '../ui/gfx/compositor/compositor.gyp:compositor',
-            '../ui/gfx/gl/gl.gyp:gl',
-          ],
           'sources/': [
             ['include', '^browser/ui/touch/*'],
             ['exclude', '^browser/chromeos/frame/browser_non_client_frame_view_factory_chromeos.cc'],
@@ -4091,14 +4085,6 @@
             ['exclude', '^browser/chromeos/input_method/candidate_window.cc'],
             ['exclude', '^browser/chromeos/input_method/candidate_window.h'],
           ],
-          'include_dirs': [
-            '../third_party/angle/include',
-          ],
-          'link_settings': {
-            'libraries': [
-              '-lXcomposite',
-            ],
-          },
         }],
         ['use_aura==1', {
           'sources/': [
@@ -4173,6 +4159,26 @@
             '../ui/aura_shell/aura_shell.gyp:aura_shell',
           ],
         }],
+        ['views_gpu_image_transport==0', {
+          'sources/': [
+            ['exclude', '^browser/renderer_host/accelerated_surface_container_touch.cc'],
+            ['exclude', '^browser/renderer_host/accelerated_surface_container_touch.h'],
+          ],
+        }],
+        ['views_gpu_image_transport==1', {
+          'dependencies': [
+            '../ui/gfx/compositor/compositor.gyp:compositor',
+            '../ui/gfx/gl/gl.gyp:gl',
+          ],
+          'link_settings': {
+            'libraries': [
+              '-lXcomposite',
+            ],
+          },
+          'include_dirs': [
+            '../third_party/angle/include',
+          ],
+        }],
         ['use_virtual_keyboard==0', {
           'sources/': [
             ['exclude', '^browser/ui/virtual_keyboard/*'],
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc
index 9f0b77c..df939bac 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.cc
+++ b/content/browser/gpu/gpu_process_host_ui_shim.cc
@@ -145,7 +145,7 @@
   return OnControlMessageReceived(message);
 }
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 
 void GpuProcessHostUIShim::SendToGpuHost(int host_id, IPC::Message* msg) {
   GpuProcessHostUIShim* ui_shim = FromID(host_id);
@@ -175,14 +175,14 @@
     IPC_MESSAGE_HANDLER(GpuHostMsg_ResizeView, OnResizeView)
 #endif
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
     IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
                         OnAcceleratedSurfaceBuffersSwapped)
     IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceNew,
                         OnAcceleratedSurfaceNew)
 #endif
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
     IPC_MESSAGE_HANDLER(GpuHostMsg_AcceleratedSurfaceRelease,
                         OnAcceleratedSurfaceRelease)
 #endif
@@ -253,7 +253,7 @@
 
 #endif
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 
 void GpuProcessHostUIShim::OnAcceleratedSurfaceNew(
     const GpuHostMsg_AcceleratedSurfaceNew_Params& params) {
@@ -303,7 +303,7 @@
                                          params.height,
                                          surface_id);
   }
-#elif defined(TOUCH_UI)
+#else  // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   view->AcceleratedSurfaceNew(
       params.width, params.height, &surface_id, &surface_handle);
 #endif
@@ -341,7 +341,7 @@
       params.renderer_id,
       params.route_id,
       host_id_);
-#elif defined(TOUCH_UI)
+#else  // defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   // view must send ACK message after next composite
   view->AcceleratedSurfaceBuffersSwapped(
       params.surface_id, params.route_id, host_id_);
@@ -350,7 +350,7 @@
 
 #endif
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 
 void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease(
     const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) {
diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h
index 92bff71..5acac4ac 100644
--- a/content/browser/gpu/gpu_process_host_ui_shim.h
+++ b/content/browser/gpu/gpu_process_host_ui_shim.h
@@ -76,7 +76,7 @@
   // actually received on the IO thread.
   virtual bool OnMessageReceived(const IPC::Message& message);
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   // TODO(apatrick): Remove this when mac does not use AcceleratedSurfaces for
   // when running the GPU thread in the browser process.
   // This is now also used in TOUCH_UI builds.
@@ -92,21 +92,22 @@
 
   void OnLogMessage(int level, const std::string& header,
       const std::string& message);
-#if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
+#if defined(TOOLKIT_USES_GTK) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) || \
+    defined(OS_WIN)
   void OnResizeView(int32 renderer_id,
                     int32 render_view_id,
                     int32 command_buffer_route_id,
                     gfx::Size size);
 #endif
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   void OnAcceleratedSurfaceNew(
       const GpuHostMsg_AcceleratedSurfaceNew_Params& params);
   void OnAcceleratedSurfaceBuffersSwapped(
       const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params);
 #endif
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   void OnAcceleratedSurfaceRelease(
       const GpuHostMsg_AcceleratedSurfaceRelease_Params& params);
 #endif
diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h
index 7ac8290..a3ccb372 100644
--- a/content/browser/renderer_host/render_widget_host_view.h
+++ b/content/browser/renderer_host/render_widget_host_view.h
@@ -256,7 +256,7 @@
   virtual void GpuRenderingStateDidChange() = 0;
 #endif
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   virtual void AcceleratedSurfaceNew(
       int32 width,
       int32 height,
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 2fe7604..cd62ab08 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -17,7 +17,7 @@
 #include "gpu/command_buffer/common/constants.h"
 #include "ui/gfx/gl/gl_switches.h"
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 #include "content/common/gpu/image_transport_surface.h"
 #endif
 
@@ -177,7 +177,7 @@
   decoder_->set_engine(scheduler_.get());
 
   if (handle_) {
-#if defined(TOUCH_UI) || defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
     if (software_) {
       OnInitializeFailed(reply_message);
       return;
@@ -241,7 +241,7 @@
   // On platforms that use an ImageTransportSurface, the surface
   // handles co-ordinating the resize with the browser process. The
   // surface sets it's own resize callback, so we shouldn't do it here.
-#if !defined(TOUCH_UI) && !defined(OS_MACOSX)
+#if !defined(OS_MACOSX) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   if (handle_ != gfx::kNullPluginWindow) {
     decoder_->SetResizeCallback(
         NewCallback(this, &GpuCommandBufferStub::OnResize));
@@ -418,7 +418,8 @@
   if (handle_ == gfx::kNullPluginWindow)
     return;
 
-#if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
+#if defined(TOOLKIT_USES_GTK) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) || \
+    defined(OS_WIN)
   GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager();
 
   // On Windows, Linux, we need to coordinate resizing of onscreen
@@ -433,11 +434,12 @@
                                 size));
 
   scheduler_->SetScheduled(false);
-#endif  // defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
+#endif
 }
 
 void GpuCommandBufferStub::ViewResized() {
-#if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
+#if defined(TOOLKIT_USES_GTK) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) || \
+    defined(OS_WIN)
   DCHECK(handle_ != gfx::kNullPluginWindow);
   scheduler_->SetScheduled(true);
 #endif
@@ -467,7 +469,7 @@
 }
 
 void GpuCommandBufferStub::SetSwapInterval() {
-#if !defined(OS_MACOSX) && !defined(TOUCH_UI)
+#if !defined(OS_MACOSX) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
   // Set up swap interval for onscreen contexts.
   if (!surface_->IsOffscreen()) {
     decoder_->MakeCurrent();
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index 2d6ad38..5a4799a 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -60,7 +60,7 @@
 IPC_STRUCT_END()
 #endif
 
-#if defined(TOUCH_UI)
+#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceNew_Params)
   IPC_STRUCT_MEMBER(int32, renderer_id)
   IPC_STRUCT_MEMBER(int32, render_view_id)
@@ -157,7 +157,8 @@
 // information.
 IPC_MESSAGE_CONTROL0(GpuMsg_CollectGraphicsInfo)
 
-#if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
+#if defined(TOOLKIT_USES_GTK) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) || \
+    defined(OS_WIN)
 // Tells the GPU process that the browser process has finished resizing the
 // view.
 IPC_MESSAGE_CONTROL2(GpuMsg_ResizeViewACK,
@@ -165,7 +166,7 @@
                      int32 /* command_buffer_id */)
 #endif
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 // Tells the GPU process that it's safe to start rendering to the surface.
 IPC_MESSAGE_ROUTED2(AcceleratedSurfaceMsg_NewACK,
                     uint64 /* surface_id */,
@@ -230,7 +231,8 @@
                      std::string /* header */,
                      std::string /* message */)
 
-#if defined(TOOLKIT_USES_GTK) && !defined(TOUCH_UI) || defined(OS_WIN)
+#if defined(TOOLKIT_USES_GTK) && !defined(UI_COMPOSITOR_IMAGE_TRANSPORT) || \
+    defined(OS_WIN)
 // Resize the window that is being drawn into. It's important that this
 // resize be synchronized with the swapping of the front and back buffers.
 IPC_MESSAGE_CONTROL4(GpuHostMsg_ResizeView,
@@ -240,7 +242,7 @@
                      gfx::Size /* size */)
 #endif
 
-#if defined(OS_MACOSX) || defined(TOUCH_UI)
+#if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
 // This message is sent from the GPU process to the browser to notify about a
 // new or resized surface in the GPU.  The browser allocates any resources
 // needed for it on its end and replies with an ACK containing any shared
diff --git a/content/content_common.gypi b/content/content_common.gypi
index a23a0602..93d2e91 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -300,7 +300,7 @@
         'common/gpu/x_util.h',
       ],
     }],
-    ['touchui==1', {
+    ['views_gpu_image_transport==1', {
       'sources': [
         'common/gpu/image_transport_surface.cc',
         'common/gpu/image_transport_surface_linux.cc',