diff options
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.cc | 17 | ||||
-rw-r--r-- | chrome/browser/renderer_host/browser_render_process_host.h | 4 |
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_ |