From 27d255b7a75a9a21fca70a90eae07c6cf22ae30b Mon Sep 17 00:00:00 2001 From: "mazda@chromium.org" Date: Fri, 11 May 2012 07:25:48 +0000 Subject: Use the GPU process for UIs by default on Aura. Removed --ui-use-gpu-process flag and made it default behavior. Also removed the code that became unnecessary. BUG=127705 TEST=Manually checked Aura Chrome worked without problem Review URL: https://chromiumcodereview.appspot.com/10378102 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136520 0039d316-1c4b-4281-b951-d872f2087c98 --- .../browser/renderer_host/gpu_message_filter.cc | 13 ++-- .../renderer_host/image_transport_factory.cc | 73 +--------------------- content/public/common/content_switches.cc | 3 - content/public/common/content_switches.h | 1 - 4 files changed, 6 insertions(+), 84 deletions(-) (limited to 'content') diff --git a/content/browser/renderer_host/gpu_message_filter.cc b/content/browser/renderer_host/gpu_message_filter.cc index 75ad4fa..e896f0c 100644 --- a/content/browser/renderer_host/gpu_message_filter.cc +++ b/content/browser/renderer_host/gpu_message_filter.cc @@ -9,7 +9,6 @@ #include "content/browser/renderer_host/gpu_message_filter.h" #include "base/bind.h" -#include "base/command_line.h" #include "base/process_util.h" #include "content/browser/gpu/browser_gpu_channel_host_factory.h" #include "content/browser/gpu/gpu_process_host.h" @@ -42,12 +41,11 @@ GpuMessageFilter::GpuMessageFilter(int render_process_id, render_widget_helper_(render_widget_helper) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kUIUseGPUProcess)) { - // When using the GPU process for UI, we need to share renderer GL contexts - // with the compositor context. - share_contexts_ = true; - } +#if defined(USE_AURA) + // We use the GPU process for UI on Aura, and we need to share renderer GL + // contexts with the compositor context. + share_contexts_ = true; +#endif } GpuMessageFilter::~GpuMessageFilter() { @@ -187,4 +185,3 @@ void GpuMessageFilter::CreateCommandBufferCallback( GpuHostMsg_CreateViewCommandBuffer::WriteReplyParams(reply, route_id); Send(reply); } - diff --git a/content/browser/renderer_host/image_transport_factory.cc b/content/browser/renderer_host/image_transport_factory.cc index 1a9dc44..de8b039 100644 --- a/content/browser/renderer_host/image_transport_factory.cc +++ b/content/browser/renderer_host/image_transport_factory.cc @@ -23,12 +23,9 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h" #include "ui/compositor/compositor.h" #include "ui/compositor/compositor_setup.h" -#include "ui/gfx/gl/gl_context.h" -#include "ui/gfx/gl/gl_surface.h" #include "ui/gfx/gl/scoped_make_current.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/size.h" -#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" using content::BrowserGpuChannelHostFactory; using content::GLHelper; @@ -114,68 +111,6 @@ class TestTransportFactory : public DefaultTransportFactory { DISALLOW_COPY_AND_ASSIGN(TestTransportFactory); }; -#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) -class InProcessTransportFactory : public DefaultTransportFactory { - public: - InProcessTransportFactory() { - // Creating 16x16 (instead of 1x1) to work around ARM Mali driver issue - // (see https://code.google.com/p/chrome-os-partner/issues/detail?id=9445) - surface_ = gfx::GLSurface::CreateOffscreenGLSurface( - false, gfx::Size(16, 16)); - CHECK(surface_.get()) << "Unable to create compositor GL surface."; - - context_ = gfx::GLContext::CreateGLContext( - NULL, surface_.get(), gfx::PreferIntegratedGpu); - CHECK(context_.get()) <<"Unable to create compositor GL context."; - - set_share_group(context_->share_group()); - } - - virtual ~InProcessTransportFactory() {} - - virtual gfx::ScopedMakeCurrent* GetScopedMakeCurrent() OVERRIDE { - return new gfx::ScopedMakeCurrent(context_.get(), surface_.get()); - } - - virtual gfx::GLSurfaceHandle CreateSharedSurfaceHandle( - ui::Compositor* compositor) OVERRIDE { - return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, true); - } - - virtual scoped_refptr CreateTransportClient( - const gfx::Size& size, - uint64* transport_handle) OVERRIDE { - scoped_refptr surface( - ImageTransportClient::Create(this, size)); - if (!surface || !surface->Initialize(transport_handle)) { - LOG(ERROR) << "Failed to create ImageTransportClient"; - return NULL; - } - return surface; - } - - virtual GLHelper* GetGLHelper(ui::Compositor* compositor) OVERRIDE { - // TODO(mazda): Implement this (http://crbug.com/118546). - return NULL; - } - - // We don't generate lost context events, so we don't need to keep track of - // observers - virtual void AddObserver(ImageTransportFactoryObserver* observer) OVERRIDE { - } - - virtual void RemoveObserver( - ImageTransportFactoryObserver* observer) OVERRIDE { - } - - private: - scoped_refptr context_; - scoped_refptr surface_; - - DISALLOW_COPY_AND_ASSIGN(InProcessTransportFactory); -}; -#endif - class ImageTransportClientTexture : public ImageTransportClient { public: explicit ImageTransportClientTexture(const gfx::Size& size) @@ -465,14 +400,8 @@ void ImageTransportFactory::Initialize() { } if (ui::IsTestCompositorEnabled()) { g_factory = new TestTransportFactory(); - } else if (command_line->HasSwitch(switches::kUIUseGPUProcess)) { - g_factory = new GpuProcessTransportFactory(); } else { -#if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) - g_factory = new InProcessTransportFactory(); -#else - g_factory = new DefaultTransportFactory(); -#endif + g_factory = new GpuProcessTransportFactory(); } ui::ContextFactory::SetInstance(g_factory->AsContextFactory()); } diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc index e689290..312d036 100644 --- a/content/public/common/content_switches.cc +++ b/content/public/common/content_switches.cc @@ -556,9 +556,6 @@ const char kTraceStartupFile[] = "trace-startup-file"; // --startup-trace-file=none was supplied. const char kTraceStartupDuration[] = "trace-startup-duration"; -// Enables the use of the GPU process for UI. Only meaningful for Aura. -const char kUIUseGPUProcess[] = "ui-use-gpu-process"; - // A string used to override the default user agent with a custom one. const char kUserAgent[] = "user-agent"; diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h index 0e0e831..a06880a 100644 --- a/content/public/common/content_switches.h +++ b/content/public/common/content_switches.h @@ -169,7 +169,6 @@ CONTENT_EXPORT extern const char kTestSandbox[]; extern const char kTraceStartup[]; extern const char kTraceStartupFile[]; extern const char kTraceStartupDuration[]; -extern const char kUIUseGPUProcess[]; CONTENT_EXPORT extern const char kUserAgent[]; extern const char kUtilityCmdPrefix[]; CONTENT_EXPORT extern const char kUtilityProcess[]; -- cgit v1.1