diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 17:27:45 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 17:27:45 +0000 |
commit | 76543b9c43515c8c68413b25d682b7c15a151905 (patch) | |
tree | 3fa26b07a2de8102561d5ded5828797fa9a375ab /chrome/plugin | |
parent | f341f8f58ceeae4efe38daf3c26ad4581f98fd2d (diff) | |
download | chromium_src-76543b9c43515c8c68413b25d682b7c15a151905.zip chromium_src-76543b9c43515c8c68413b25d682b7c15a151905.tar.gz chromium_src-76543b9c43515c8c68413b25d682b7c15a151905.tar.bz2 |
Replace the RenderProcessHost.PID function that returns the OS-generated
process ID with an internally-generated id() function. This allows us the
guarantee that the IDs are unique over the entire run of the application.
This also cleans up some code associated with managing the PID.
The main potentially interesting change is now the PID is set uniquely for
every creation of RenderProcessHost. It used to be set cleared if the process
went away, and re-set if the process was re-created. The ID generation is in
ChildProcesInfo so it is also unique between workers and plugins. I had to
change some significant things in resource_dispatcher_host_unittest to take
into account this new generation of IDs.
BUG=17828
TEST=none
Review URL: http://codereview.chromium.org/160203
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24899 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/plugin_channel.cc | 10 | ||||
-rw-r--r-- | chrome/plugin/plugin_channel.h | 7 | ||||
-rw-r--r-- | chrome/plugin/plugin_thread.cc | 7 |
3 files changed, 13 insertions, 11 deletions
diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index 04d9afc..c813e4c 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 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. @@ -27,11 +27,11 @@ class PluginReleaseTask : public Task { // How long we wait before releasing the plugin process. static const int kPluginReleaseTimeMS = 10000; -PluginChannel* PluginChannel::GetPluginChannel( - int process_id, MessageLoop* ipc_message_loop) { - // map renderer's process id to a (single) channel to that process +PluginChannel* PluginChannel::GetPluginChannel(int renderer_id, + MessageLoop* ipc_message_loop) { + // Map renderer ID to a (single) channel to that process. std::string channel_name = StringPrintf( - "%d.r%d", base::GetCurrentProcId(), process_id); + "%d.r%d", base::GetCurrentProcId(), renderer_id); return static_cast<PluginChannel*>(PluginChannelBase::GetChannel( channel_name, diff --git a/chrome/plugin/plugin_channel.h b/chrome/plugin/plugin_channel.h index 02b619e..58e711f 100644 --- a/chrome/plugin/plugin_channel.h +++ b/chrome/plugin/plugin_channel.h @@ -15,10 +15,13 @@ // process. On the renderer side there's a corresponding PluginChannelHost. class PluginChannel : public PluginChannelBase { public: - // Get a new PluginChannel object for the current process. + // Get a new PluginChannel object for the current process to talk to the + // given rendeer process. The renderer ID is an opaque unique ID generated by + // the browser. + // // POSIX only: If |channel_fd| > 0, use that file descriptor for the // channel socket. - static PluginChannel* GetPluginChannel(int process_id, + static PluginChannel* GetPluginChannel(int renderer_id, MessageLoop* ipc_message_loop); ~PluginChannel(); diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 307cbaa..c2a21bd 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -98,11 +98,10 @@ void PluginThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_END_MESSAGE_MAP() } -void PluginThread::OnCreateChannel( - int process_id, - bool off_the_record) { +void PluginThread::OnCreateChannel(int renderer_id, + bool off_the_record) { scoped_refptr<PluginChannel> channel = PluginChannel::GetPluginChannel( - process_id, ChildProcess::current()->io_message_loop()); + renderer_id, ChildProcess::current()->io_message_loop()); IPC::ChannelHandle channel_handle; if (channel.get()) { channel_handle.name = channel->channel_name(); |