summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_main.cc
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 01:18:37 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 01:18:37 +0000
commit9f20a6d0e6153489efe035c860f249c7cbc28890 (patch)
tree27fc986ae9f9600d12268ea043156048400712d8 /chrome/browser/browser_main.cc
parent0a1f310d964e67756c8316330ffb090048c9ae82 (diff)
downloadchromium_src-9f20a6d0e6153489efe035c860f249c7cbc28890.zip
chromium_src-9f20a6d0e6153489efe035c860f249c7cbc28890.tar.gz
chromium_src-9f20a6d0e6153489efe035c860f249c7cbc28890.tar.bz2
Make ProcessSingletonLinux check the hostname to avoid multiple uses of a profile over NFS.
In order to avoid the singleton socket filename from exceeding the max socket name length, the socket is just named "SingletonSocket" and a new file "SingletonLock" is used for the hostname&pid. BUG=17549 TEST=see bug Review URL: http://codereview.chromium.org/174041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r--chrome/browser/browser_main.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index d6dd7e2..bb3d1c3 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -588,12 +588,23 @@ int BrowserMain(const MainFunctionParams& parameters) {
return FirstRun::ImportNow(profile, parsed_command_line);
// When another process is running, use it instead of starting us.
- if (process_singleton.NotifyOtherProcess()) {
+ switch (process_singleton.NotifyOtherProcess()) {
+ case ProcessSingleton::PROCESS_NONE:
+ // No process already running, fall through to starting a new one.
+ break;
+
+ case ProcessSingleton::PROCESS_NOTIFIED:
#if defined(OS_LINUX)
- printf("%s\n", base::SysWideToNativeMB(
- l10n_util::GetString(IDS_USED_EXISTING_BROWSER)).c_str());
+ printf("%s\n", base::SysWideToNativeMB(
+ l10n_util::GetString(IDS_USED_EXISTING_BROWSER)).c_str());
#endif
- return ResultCodes::NORMAL_EXIT;
+ return ResultCodes::NORMAL_EXIT;
+
+ case ProcessSingleton::PROFILE_IN_USE:
+ return ResultCodes::PROFILE_IN_USE;
+
+ default:
+ NOTREACHED();
}
// Do the tasks if chrome has been upgraded while it was last running.
@@ -806,6 +817,8 @@ int BrowserMain(const MainFunctionParams& parameters) {
}
}
+ process_singleton.Cleanup();
+
Platform::WillTerminate();
if (metrics)