summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
authortonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 20:46:37 +0000
committertonyg@chromium.org <tonyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 20:46:37 +0000
commit34ce848a57340642bb708d44bf1e6fa4ea3a07b5 (patch)
treec579d8eaf1e5c44cc6453826ce27093e98d46589 /chrome/app
parent3632e9cce4c6deb5ed398b739f4d41fa0ede91c3 (diff)
downloadchromium_src-34ce848a57340642bb708d44bf1e6fa4ea3a07b5.zip
chromium_src-34ce848a57340642bb708d44bf1e6fa4ea3a07b5.tar.gz
chromium_src-34ce848a57340642bb708d44bf1e6fa4ea3a07b5.tar.bz2
Fix StatsCounters on mac.
In order for the shared memory to work, they must all use the same file name which is keyed by the pid of the browser process. Previously the mac code path was using the pid for each process so there was no sharing happening. Now mac uses the same code path as win which properly uses the parent pid for all procs. BUG=None TEST=None Review URL: http://codereview.chromium.org/6364006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/chrome_main.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc
index 621350d..edd4c0d 100644
--- a/chrome/app/chrome_main.cc
+++ b/chrome/app/chrome_main.cc
@@ -682,22 +682,23 @@ int ChromeMain(int argc, char** argv) {
base::ProcessId browser_pid = base::GetCurrentProcId();
if (SubprocessIsBrowserChild(process_type)) {
-#if defined(OS_WIN)
+#if defined(OS_WIN) || defined(OS_MACOSX)
std::string channel_name =
command_line.GetSwitchValueASCII(switches::kProcessChannelID);
int browser_pid_int;
base::StringToInt(channel_name, &browser_pid_int);
browser_pid = static_cast<base::ProcessId>(browser_pid_int);
- DCHECK_NE(browser_pid, 0u);
-#elif defined(OS_MACOSX)
- browser_pid = base::GetCurrentProcId();
- SendTaskPortToParentProcess();
+ DCHECK_NE(browser_pid_int, 0);
#elif defined(OS_POSIX)
// On linux, we're in the zygote here; so we need the parent process' id.
browser_pid = base::GetParentProcessId(base::GetCurrentProcId());
#endif
+#if defined(OS_MACOSX)
+ SendTaskPortToParentProcess();
+#endif
+
#if defined(OS_POSIX)
// When you hit Ctrl-C in a terminal running the browser
// process, a SIGINT is delivered to the entire process group.
@@ -765,7 +766,6 @@ int ChromeMain(int argc, char** argv) {
}
}
-#if defined(OS_MACOSX)
// Mac Chrome is packaged with a main app bundle and a helper app bundle.
// The main app bundle should only be used for the browser process, so it
// should never see a --type switch (switches::kProcessType). Likewise,
@@ -783,11 +783,10 @@ int ChromeMain(int argc, char** argv) {
CHECK(!command_line.HasSwitch(switches::kProcessType))
<< "Main application forbids --type, saw \"" << process_type << "\".";
}
-#endif // defined(OS_MACOSX)
if (IsCrashReporterEnabled())
InitCrashProcessInfo();
-#endif // OS_MACOSX
+#endif // defined(OS_MACOSX)
InitializeStatsTable(browser_pid, command_line);