Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1866)

Unified Diff: chrome/browser/process_singleton_linux.cc

Issue 209018: linux: expose the ProcessSingleton timeout to speed tests (Closed)
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/process_singleton_linux.cc
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index db2d31d24afe7be1e7324203cd42010a65976a7a..a6ca75636232c26a80b337a350583414e870db79 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 /* seconds */);
Paweł Hajdan Jr. 2009/09/17 19:45:56 nit: Is this /* seconds */ comment necessary? The
Evan Martin 2009/09/17 20:37:13 Good catch. It was leftover from before I had not
+}
+
+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) {

Powered by Google App Engine
This is Rietveld 408576698