diff options
author | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-04 05:34:19 +0000 |
---|---|---|
committer | suzhe@chromium.org <suzhe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-04 05:34:19 +0000 |
commit | 8b08cbd679e2db2799754557842659d9077ca1d4 (patch) | |
tree | fdcfccb983425b9e46c457c8db7aa9b3c13ee0d8 /chrome/browser/process_singleton.h | |
parent | fe63292b5ff8a734578877d192c7f89aa3845e87 (diff) | |
download | chromium_src-8b08cbd679e2db2799754557842659d9077ca1d4.zip chromium_src-8b08cbd679e2db2799754557842659d9077ca1d4.tar.gz chromium_src-8b08cbd679e2db2799754557842659d9077ca1d4.tar.bz2 |
It's a copy of http://codereview.chromium.org/155772, with the fix for valgrind test failure.
This CL implements the second TODO item of issue 12343:
2) We should send back an ACK to the second process. If the second process doesn't get an ACK in the given timeout, it should kill the first process and go ahead and start.
The approach of this CL is to append process id to the singleton's socket filename, such as "SingletonSocket-12345", and creates a symbol link "SingletonSocket" to the real socket file. In ProcessSingleton::NotifyOtherProcess() if it's successfully connected to "SingletonSocket" but no ACK received, then the original process can be killed by its process id retrieved from the symbol link.
BUG=12343 ProcessSingleton Linux cleanups
TEST=In one terminal, launch chrome and stop the process by pressing ctrl-z, then launch chrome again in another terminal. The second chrome shall be started in 5 seconds, and the first one shall be killed.
Review URL: http://codereview.chromium.org/160436
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22365 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_singleton.h')
-rw-r--r-- | chrome/browser/process_singleton.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h index 3ef620a..ed572fe 100644 --- a/chrome/browser/process_singleton.h +++ b/chrome/browser/process_singleton.h @@ -68,6 +68,12 @@ class ProcessSingleton : public NonThreadSafe { } private: +#if defined(OS_WIN) || defined(OS_LINUX) + // Timeout for the current browser process to respond. 20 seconds should be + // enough. It's only used in Windows and Linux implementations. + static const int kTimeoutInSeconds = 20; +#endif + bool locked_; gfx::NativeWindow foreground_window_; @@ -92,9 +98,6 @@ class ProcessSingleton : public NonThreadSafe { HWND remote_window_; // The HWND_MESSAGE of another browser. HWND window_; // The HWND_MESSAGE window. #elif defined(OS_LINUX) - // Set up a socket and sockaddr appropriate for messaging. - void SetupSocket(int* sock, struct sockaddr_un* addr); - // Path in file system to the socket. FilePath socket_path_; |