diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 01:55:13 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-12 01:55:13 +0000 |
commit | 4566f13fe843c0821dbce19d7ea5e8aece8afe4a (patch) | |
tree | 586c6006431604f6b159daca30fcdfe4913ad996 /chrome/plugin/plugin_channel.cc | |
parent | 3f366001f70b1ef4b8884796970cefb0769c469f (diff) | |
download | chromium_src-4566f13fe843c0821dbce19d7ea5e8aece8afe4a.zip chromium_src-4566f13fe843c0821dbce19d7ea5e8aece8afe4a.tar.gz chromium_src-4566f13fe843c0821dbce19d7ea5e8aece8afe4a.tar.bz2 |
Stop having renderers use both pids and a monotonically increasing "host_id". This allows ResourceDispatcher to be used by child processes other than renderers. I've done minor related cleanup on the way to make the code simpler.
Review URL: http://codereview.chromium.org/42054
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/plugin_channel.cc')
-rw-r--r-- | chrome/plugin/plugin_channel.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index 4774d8c..675a46f 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -8,29 +8,23 @@ #include "chrome/common/plugin_messages.h" #include "base/command_line.h" +#include "base/process_util.h" #include "base/string_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/plugin/plugin_process.h" #include "chrome/plugin/plugin_thread.h" -PluginChannel* PluginChannel::GetPluginChannel( - int process_id, HANDLE renderer_handle, MessageLoop* ipc_message_loop) { - // map renderer's process id to a (single) channel to that process +PluginChannel* PluginChannel::GetPluginChannel(MessageLoop* ipc_message_loop) { + static int next_id; std::wstring channel_name = StringPrintf( - L"%d.r%d", GetCurrentProcessId(), process_id); + L"%d.r%d", GetCurrentProcessId(), ++next_id); - PluginChannelBase* result = PluginChannelBase::GetChannel( + return static_cast<PluginChannel*>(PluginChannelBase::GetChannel( channel_name, IPC::Channel::MODE_SERVER, ClassFactory, ipc_message_loop, - false); - - PluginChannel* channel = static_cast<PluginChannel*>(result); - if (channel && !channel->renderer_handle()) - channel->renderer_handle_.Set(renderer_handle); - - return channel; + false)); } PluginChannel::PluginChannel() : in_send_(0) { @@ -105,6 +99,11 @@ int PluginChannel::GenerateRouteID() { return InterlockedIncrement(&last_id); } +void PluginChannel::OnChannelConnected(int32 peer_pid) { + renderer_handle_.Set(base::OpenProcessHandle(peer_pid)); + PluginChannelBase::OnChannelConnected(peer_pid); +} + void PluginChannel::OnChannelError() { renderer_handle_.Set(NULL); PluginChannelBase::OnChannelError(); |