diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 01:18:37 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 01:18:37 +0000 |
commit | 9f20a6d0e6153489efe035c860f249c7cbc28890 (patch) | |
tree | 27fc986ae9f9600d12268ea043156048400712d8 /chrome/browser/process_singleton.h | |
parent | 0a1f310d964e67756c8316330ffb090048c9ae82 (diff) | |
download | chromium_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/process_singleton.h')
-rw-r--r-- | chrome/browser/process_singleton.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h index ed572fe..122618f 100644 --- a/chrome/browser/process_singleton.h +++ b/chrome/browser/process_singleton.h @@ -31,6 +31,12 @@ class ProcessSingleton : public NonThreadSafe { public: + enum NotifyResult { + PROCESS_NONE, + PROCESS_NOTIFIED, + PROFILE_IN_USE, + }; + explicit ProcessSingleton(const FilePath& user_data_dir); ~ProcessSingleton(); @@ -41,11 +47,14 @@ class ProcessSingleton : public NonThreadSafe { // TODO(brettw): this will not handle all cases. If two process start up too // close to each other, the Create() might not yet have happened for the // first one, so this function won't find it. - bool NotifyOtherProcess(); + NotifyResult NotifyOtherProcess(); // Sets ourself up as the singleton instance. void Create(); + // Clear any lock state during shutdown. + void Cleanup(); + // Blocks the dispatch of CopyData messages. foreground_window refers // to the window that should be set to the foreground if a CopyData message // is received while the ProcessSingleton is locked. @@ -101,6 +110,9 @@ class ProcessSingleton : public NonThreadSafe { // Path in file system to the socket. FilePath socket_path_; + // Path in file system to the lock. + FilePath lock_path_; + // Helper class for linux specific messages. LinuxWatcher is ref counted // because it posts messages between threads. class LinuxWatcher; |