summaryrefslogtreecommitdiffstats
path: root/chrome/browser/process_singleton_linux.cc
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 21:00:18 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-17 21:00:18 +0000
commitc0d297956354b9c74fdcfb717efb272a772f4315 (patch)
tree94beb2ca93a6e9ad36952c6ef163f67f3da58b1e /chrome/browser/process_singleton_linux.cc
parent5d8128106e8bae8784d9468706198c61c505641b (diff)
downloadchromium_src-c0d297956354b9c74fdcfb717efb272a772f4315.zip
chromium_src-c0d297956354b9c74fdcfb717efb272a772f4315.tar.gz
chromium_src-c0d297956354b9c74fdcfb717efb272a772f4315.tar.bz2
linux: expose the ProcessSingleton timeout to speed tests
We have a 20-second timeout normally, but for testing purposes 1 second is plenty. Review URL: http://codereview.chromium.org/209018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_singleton_linux.cc')
-rw-r--r--chrome/browser/process_singleton_linux.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index db2d31d..634b68f 100644
--- a/chrome/browser/process_singleton_linux.cc
+++ b/chrome/browser/process_singleton_linux.cc
@@ -627,6 +627,11 @@ ProcessSingleton::~ProcessSingleton() {
}
ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
+ return NotifyOtherProcessWithTimeout(kTimeoutInSeconds);
+}
+
+ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
+ int timeout_seconds) {
int socket;
sockaddr_un addr;
SetupSocket(socket_path_.value(), &socket, &addr);
@@ -648,7 +653,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
return PROCESS_NONE; // Tell the caller there's nobody to notify.
}
- timeval timeout = {20, 0};
+ timeval timeout = {timeout_seconds, 0};
setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
// Found another process, prepare our command line
@@ -684,7 +689,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
// timeout, to make sure the other process has enough time to return ACK.
char buf[kMaxACKMessageLength + 1];
ssize_t len =
- ReadFromSocket(socket, buf, kMaxACKMessageLength, kTimeoutInSeconds);
+ ReadFromSocket(socket, buf, kMaxACKMessageLength, timeout_seconds);
// Failed to read ACK, the other process might have been frozen.
if (len <= 0) {