diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-08 01:31:28 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-08 01:31:28 +0000 |
commit | d8d97c2224367396e57bc69294beaea7002f1f14 (patch) | |
tree | d244686ba1cde27647c3f430308116303f2e6705 /content/common | |
parent | 6bba9e85d2c95d8657ebf348e49547ed2622a0c9 (diff) | |
download | chromium_src-d8d97c2224367396e57bc69294beaea7002f1f14.zip chromium_src-d8d97c2224367396e57bc69294beaea7002f1f14.tar.gz chromium_src-d8d97c2224367396e57bc69294beaea7002f1f14.tar.bz2 |
Fix context sharing between channels to be order-independent.
Ensuring order of channel recreation after a GPU process death is very hard.
With this there's not need. A channel is either shared or not, all the "shared"
channels share their context together, every other one doesn't share with
anything. More restrictive but it's enough for our needs.
BUG=116913
TEST=chrome --ui-use-gpu-process, kill GPU process, observe GpuChannelManager::OnEstablishChannel crash doesn't happen.
Review URL: https://chromiumcodereview.appspot.com/9619017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/gpu/gpu_channel_manager.cc | 11 | ||||
-rw-r--r-- | content/common/gpu/gpu_channel_manager.h | 7 | ||||
-rw-r--r-- | content/common/gpu/gpu_messages.h | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc index 910694f..e602d43 100644 --- a/content/common/gpu/gpu_channel_manager.cc +++ b/content/common/gpu/gpu_channel_manager.cc @@ -9,6 +9,7 @@ #include "content/common/gpu/gpu_channel.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/gpu_memory_manager.h" +#include "ui/gfx/gl/gl_share_group.h" GpuChannelManager::GpuChannelManager(ChildThread* gpu_child_thread, GpuWatchdog* watchdog, @@ -82,14 +83,14 @@ bool GpuChannelManager::Send(IPC::Message* msg) { return gpu_child_thread_->Send(msg); } -void GpuChannelManager::OnEstablishChannel(int client_id, int share_client_id) { +void GpuChannelManager::OnEstablishChannel(int client_id, bool share_context) { IPC::ChannelHandle channel_handle; gfx::GLShareGroup* share_group = NULL; - if (share_client_id) { - GpuChannel* share_channel = gpu_channels_[share_client_id]; - DCHECK(share_channel); - share_group = share_channel->share_group(); + if (share_context) { + if (!share_group_) + share_group_ = new gfx::GLShareGroup; + share_group = share_group_; } scoped_refptr<GpuChannel> channel = new GpuChannel(this, diff --git a/content/common/gpu/gpu_channel_manager.h b/content/common/gpu/gpu_channel_manager.h index 01b8b7c..9fe1b26 100644 --- a/content/common/gpu/gpu_channel_manager.h +++ b/content/common/gpu/gpu_channel_manager.h @@ -20,6 +20,10 @@ namespace base { class WaitableEvent; } +namespace gfx { +class GLShareGroup; +} + namespace IPC { struct ChannelHandle; } @@ -76,7 +80,7 @@ class GpuChannelManager : public IPC::Channel::Listener, private: // Message handlers. - void OnEstablishChannel(int client_id, int share_client_id); + void OnEstablishChannel(int client_id, bool share_context); void OnCloseChannel(const IPC::ChannelHandle& channel_handle); void OnVisibilityChanged( int32 render_view_id, int32 client_id, bool visible); @@ -99,6 +103,7 @@ class GpuChannelManager : public IPC::Channel::Listener, // process. typedef base::hash_map<int, scoped_refptr<GpuChannel> > GpuChannelMap; GpuChannelMap gpu_channels_; + scoped_refptr<gfx::GLShareGroup> share_group_; GpuMemoryManager gpu_memory_manager_; GpuWatchdog* watchdog_; diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h index 0b600ab..a8cf142 100644 --- a/content/common/gpu/gpu_messages.h +++ b/content/common/gpu/gpu_messages.h @@ -157,7 +157,7 @@ IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) // This ID is a unique opaque identifier generated by the browser process. IPC_MESSAGE_CONTROL2(GpuMsg_EstablishChannel, int /* client_id */, - int /* share_client_id */) + bool /* share_context */) // Tells the GPU process to close the channel identified by IPC channel // handle. If no channel can be identified, do nothing. |