diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 22:30:07 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 22:30:07 +0000 |
commit | e608ce0911ee1764b93d8cd667d6eabbd083ab96 (patch) | |
tree | 1438be09f2e2dee426a3bff149a51cd826358cd7 /content/browser/gpu | |
parent | c5651f4a4e0581a53525ad59bfb1fecfeb6ed6bb (diff) | |
download | chromium_src-e608ce0911ee1764b93d8cd667d6eabbd083ab96.zip chromium_src-e608ce0911ee1764b93d8cd667d6eabbd083ab96.tar.gz chromium_src-e608ce0911ee1764b93d8cd667d6eabbd083ab96.tar.bz2 |
Add the ability to share GL contexts across channels.
This is patch 1 of many to enable the use of the GPU process for the browser UI.
Before this, all contexts within one channel were shared, but not across channels. With this patch channels can choose to share contexts with other ones.
This patch also renames the various "renderer_id" to "client_id", since the GPU process doesn't care that the other side is a renderer or not.
BUG=99516
TEST=None yet, but will come with later patches
Review URL: http://codereview.chromium.org/9107033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu')
-rw-r--r-- | content/browser/gpu/gpu_process_host.cc | 24 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host.h | 14 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.cc | 14 | ||||
-rw-r--r-- | content/browser/gpu/gpu_process_host_ui_shim.h | 4 |
4 files changed, 28 insertions, 28 deletions
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc index 480bd9d..cc70bed 100644 --- a/content/browser/gpu/gpu_process_host.cc +++ b/content/browser/gpu/gpu_process_host.cc @@ -74,11 +74,11 @@ void ReleasePermanentXIDDispatcher(gfx::PluginWindowHandle surface) { #endif -void SendGpuProcessMessage(int renderer_id, +void SendGpuProcessMessage(int client_id, content::CauseForGpuLaunch cause, IPC::Message* message) { GpuProcessHost* host = GpuProcessHost::GetForRenderer( - renderer_id, cause); + client_id, cause); if (host) { host->Send(message); } else { @@ -183,7 +183,7 @@ static bool HostIsValid(GpuProcessHost* host) { // static GpuProcessHost* GpuProcessHost::GetForRenderer( - int renderer_id, content::CauseForGpuLaunch cause) { + int client_id, content::CauseForGpuLaunch cause) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // Don't grant further access to GPU if it is not allowed. @@ -221,13 +221,13 @@ GpuProcessHost* GpuProcessHost::GetForRenderer( } // static -void GpuProcessHost::SendOnIO(int renderer_id, +void GpuProcessHost::SendOnIO(int client_id, content::CauseForGpuLaunch cause, IPC::Message* message) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind( - &SendGpuProcessMessage, renderer_id, cause, message)); + &SendGpuProcessMessage, client_id, cause, message)); } // static @@ -379,7 +379,7 @@ void GpuProcessHost::OnChannelConnected(int32 peer_pid) { } void GpuProcessHost::EstablishGpuChannel( - int renderer_id, + int client_id, const EstablishChannelCallback& callback) { DCHECK(CalledOnValidThread()); TRACE_EVENT0("gpu", "GpuProcessHostUIShim::EstablishGpuChannel"); @@ -392,7 +392,7 @@ void GpuProcessHost::EstablishGpuChannel( return; } - if (Send(new GpuMsg_EstablishChannel(renderer_id))) { + if (Send(new GpuMsg_EstablishChannel(client_id, 0))) { channel_requests_.push(callback); } else { EstablishChannelError( @@ -404,13 +404,13 @@ void GpuProcessHost::EstablishGpuChannel( void GpuProcessHost::CreateViewCommandBuffer( gfx::PluginWindowHandle compositing_surface, int32 render_view_id, - int32 renderer_id, + int32 client_id, const GPUCreateCommandBufferConfig& init_params, const CreateCommandBufferCallback& callback) { DCHECK(CalledOnValidThread()); #if defined(TOOLKIT_USES_GTK) - ViewID view_id(renderer_id, render_view_id); + ViewID view_id(client_id, render_view_id); // There should only be one such command buffer (for the compositor). In // practice, if the GPU process lost a context, GraphicsContext3D with @@ -426,7 +426,7 @@ void GpuProcessHost::CreateViewCommandBuffer( if (compositing_surface != gfx::kNullPluginWindow && Send(new GpuMsg_CreateViewCommandBuffer( - compositing_surface, render_view_id, renderer_id, init_params))) { + compositing_surface, render_view_id, client_id, init_params))) { create_command_buffer_requests_.push(callback); #if defined(TOOLKIT_USES_GTK) surface_refs_.insert(std::pair<ViewID, linked_ptr<SurfaceRef> >( @@ -479,10 +479,10 @@ void GpuProcessHost::OnCommandBufferCreated(const int32 route_id) { } void GpuProcessHost::OnDestroyCommandBuffer( - gfx::PluginWindowHandle window, int32 renderer_id, + gfx::PluginWindowHandle window, int32 client_id, int32 render_view_id) { #if defined(TOOLKIT_USES_GTK) - ViewID view_id(renderer_id, render_view_id); + ViewID view_id(client_id, render_view_id); SurfaceRefMap::iterator it = surface_refs_.find(view_id); if (it != surface_refs_.end()) surface_refs_.erase(it); diff --git a/content/browser/gpu/gpu_process_host.h b/content/browser/gpu/gpu_process_host.h index e383e0c..295803a 100644 --- a/content/browser/gpu/gpu_process_host.h +++ b/content/browser/gpu/gpu_process_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -37,13 +37,13 @@ class GpuProcessHost : public BrowserChildProcessHost, // has returned to the message loop as it can be destroyed. Instead store the // associated GPU host ID. A renderer ID of zero means the browser process. // This could return NULL if GPU access is not allowed (blacklisted). - static GpuProcessHost* GetForRenderer(int renderer_id, + static GpuProcessHost* GetForRenderer(int client_id, content::CauseForGpuLaunch cause); // Helper function to send the given message to the GPU process on the IO // thread. Calls GetForRenderer and if a host is returned, sends it. // Can be called from any thread. - CONTENT_EXPORT static void SendOnIO(int renderer_id, + CONTENT_EXPORT static void SendOnIO(int client_id, content::CauseForGpuLaunch cause, IPC::Message* message); @@ -67,7 +67,7 @@ class GpuProcessHost : public BrowserChildProcessHost, // renderer. Once the GPU process responds asynchronously with the IPC handle // and GPUInfo, we call the callback. void EstablishGpuChannel( - int renderer_id, const EstablishChannelCallback& callback); + int client_id, const EstablishChannelCallback& callback); typedef base::Callback<void(int32)> CreateCommandBufferCallback; @@ -76,7 +76,7 @@ class GpuProcessHost : public BrowserChildProcessHost, void CreateViewCommandBuffer( gfx::PluginWindowHandle compositing_surface, int32 render_view_id, - int32 renderer_id, + int32 client_id, const GPUCreateCommandBufferConfig& init_params, const CreateCommandBufferCallback& callback); @@ -101,7 +101,7 @@ class GpuProcessHost : public BrowserChildProcessHost, void OnChannelEstablished(const IPC::ChannelHandle& channel_handle); void OnCommandBufferCreated(const int32 route_id); void OnDestroyCommandBuffer( - gfx::PluginWindowHandle window, int32 renderer_id, int32 render_view_id); + gfx::PluginWindowHandle window, int32 client_id, int32 render_view_id); bool LaunchGpuProcess(const std::string& channel_id); @@ -125,7 +125,7 @@ class GpuProcessHost : public BrowserChildProcessHost, std::queue<CreateCommandBufferCallback> create_command_buffer_requests_; #if defined(TOOLKIT_USES_GTK) - typedef std::pair<int32 /* renderer_id */, + typedef std::pair<int32 /* client_id */, int32 /* render_view_id */> ViewID; // Encapsulates surfaces that we lock when creating view command buffers. diff --git a/content/browser/gpu/gpu_process_host_ui_shim.cc b/content/browser/gpu/gpu_process_host_ui_shim.cc index 0dda528..488553d 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.cc +++ b/content/browser/gpu/gpu_process_host_ui_shim.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -226,7 +226,7 @@ void GpuProcessHostUIShim::OnGraphicsInfoCollected( #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) -void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, +void GpuProcessHostUIShim::OnResizeView(int32 client_id, int32 render_view_id, int32 route_id, gfx::Size size) { @@ -237,7 +237,7 @@ void GpuProcessHostUIShim::OnResizeView(int32 renderer_id, host_id_, new AcceleratedSurfaceMsg_ResizeViewACK(route_id)); - RenderWidgetHostView* view = GetRenderWidgetHostViewFromID(renderer_id, + RenderWidgetHostView* view = GetRenderWidgetHostViewFromID(client_id, render_view_id); if (!view) return; @@ -282,7 +282,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceNew( TransportDIB::DefaultHandleValue())); RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; @@ -337,7 +337,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfaceBuffersSwapped( new AcceleratedSurfaceMsg_BuffersSwappedACK(params.route_id)); RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; @@ -357,7 +357,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( new AcceleratedSurfaceMsg_PostSubBufferACK(params.route_id)); RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; @@ -372,7 +372,7 @@ void GpuProcessHostUIShim::OnAcceleratedSurfacePostSubBuffer( void GpuProcessHostUIShim::OnAcceleratedSurfaceRelease( const GpuHostMsg_AcceleratedSurfaceRelease_Params& params) { RenderWidgetHostView* view = GetRenderWidgetHostViewFromID( - params.renderer_id, params.render_view_id); + params.client_id, params.render_view_id); if (!view) return; view->AcceleratedSurfaceRelease(params.identifier); diff --git a/content/browser/gpu/gpu_process_host_ui_shim.h b/content/browser/gpu/gpu_process_host_ui_shim.h index 6d84251..119a802 100644 --- a/content/browser/gpu/gpu_process_host_ui_shim.h +++ b/content/browser/gpu/gpu_process_host_ui_shim.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -83,7 +83,7 @@ class GpuProcessHostUIShim void OnLogMessage(int level, const std::string& header, const std::string& message); #if defined(TOOLKIT_USES_GTK) || defined(OS_WIN) - void OnResizeView(int32 renderer_id, + void OnResizeView(int32 client_id, int32 render_view_id, int32 route_id, gfx::Size size); |