diff options
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index a0e1e8a..e54d207 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -259,6 +259,18 @@ int ChromeMain(int argc, const char** argv) { return 1; #endif + int browser_pid; + std::wstring process_type = + parsed_command_line.GetSwitchValue(switches::kProcessType); + if (process_type.empty()) { + browser_pid = base::GetCurrentProcId(); + } else { + std::wstring channel_name = + parsed_command_line.GetSwitchValue(switches::kProcessChannelID); + + browser_pid = StringToInt(WideToASCII(channel_name)); + DCHECK(browser_pid != 0); + } SetupCRT(parsed_command_line); // Initialize the Chrome path provider. @@ -271,9 +283,8 @@ int ChromeMain(int argc, const char** argv) { // of the process. It is not cleaned up. // TODO(port): we probably need to shut this down correctly to avoid // leaking shared memory regions on posix platforms. - std::string statsfile = chrome::kStatsFilename; - std::string pid_string = StringPrintf("-%d", base::GetCurrentProcId()); - statsfile += pid_string; + std::string statsfile = + StringPrintf("%s-%d", chrome::kStatsFilename, browser_pid); StatsTable *stats_table = new StatsTable(statsfile, chrome::kStatsMaxThreads, chrome::kStatsMaxCounters); StatsTable::set_current(stats_table); @@ -288,9 +299,6 @@ int ChromeMain(int argc, const char** argv) { if (parsed_command_line.HasSwitch(switches::kMessageLoopHistogrammer)) MessageLoop::EnableHistogrammer(true); - std::wstring process_type = - parsed_command_line.GetSwitchValue(switches::kProcessType); - // Checks if the sandbox is enabled in this process and initializes it if this // is the case. The crash handler depends on this so it has to be done before // its initialization. |