summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 03:47:48 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-18 03:47:48 +0000
commit6dffde32e9bf00108ebe936b06f02fc80ed09fb4 (patch)
treed2da2ecf38102a7b7997bbf5a3542a588fbeb330 /chrome/browser/renderer_host
parent8c6add3b6648649eeadb60abdecbf6a1bec01860 (diff)
downloadchromium_src-6dffde32e9bf00108ebe936b06f02fc80ed09fb4.zip
chromium_src-6dffde32e9bf00108ebe936b06f02fc80ed09fb4.tar.gz
chromium_src-6dffde32e9bf00108ebe936b06f02fc80ed09fb4.tar.bz2
Take out common functionality from PluginProcessHost and move it to ChildProcessHost.
Review URL: http://codereview.chromium.org/21443 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc17
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h4
2 files changed, 3 insertions, 18 deletions
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 20bd867..eda2f1a 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/renderer_host/resource_message_filter.h"
#include "chrome/browser/visitedlink_master.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/child_process_info.h"
#include "chrome/common/debug_flags.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/notification_service.h"
@@ -218,7 +219,8 @@ bool BrowserRenderProcessHost::Init() {
const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
// setup IPC channel
- const std::wstring channel_id = GenerateRandomChannelID(this);
+ const std::wstring channel_id =
+ ChildProcessInfo::GenerateRandomChannelID(this);
channel_.reset(
new IPC::SyncChannel(channel_id, IPC::Channel::MODE_SERVER, this,
resource_message_filter,
@@ -813,16 +815,3 @@ void BrowserRenderProcessHost::Observe(NotificationType type,
}
}
}
-
-std::wstring GenerateRandomChannelID(void* instance) {
- // Note: the string must start with the current process id, this is how
- // child processes determine the pid of the parent.
- // Build the channel ID. This is composed of a unique identifier for the
- // parent browser process, an identifier for the renderer/plugin instance,
- // and a random component. We use a random component so that a hacked child
- // process can't cause denial of service by causing future named pipe creation
- // to fail.
- return StringPrintf(L"%d.%x.%d",
- base::GetCurrentProcId(), instance,
- base::RandInt(0, std::numeric_limits<int>::max()));
-}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index d089516..be7e225 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -143,8 +143,4 @@ class BrowserRenderProcessHost : public RenderProcessHost,
DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost);
};
-// Generates a unique channel name for a child renderer/plugin process.
-// The "instance" pointer value is baked into the channel id.
-std::wstring GenerateRandomChannelID(void* instance);
-
#endif // CHROME_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_