Chromium Code Reviews| Index: chrome/browser/chrome_process_finder_win.cc |
| diff --git a/chrome/browser/chrome_process_finder_win.cc b/chrome/browser/chrome_process_finder_win.cc |
| index 0fe88448bf3ee569a5c537c083d398d2e500d7d5..60a6b5afb63dbab755f0ad6812cf19ecdd157729 100644 |
| --- a/chrome/browser/chrome_process_finder_win.cc |
| +++ b/chrome/browser/chrome_process_finder_win.cc |
| @@ -28,7 +28,9 @@ |
| namespace { |
| -const int kTimeoutInSeconds = 20; |
| +const int kDefaultTimeoutInSeconds = 20; |
|
sky
2015/03/11 19:15:51
There is no point in this constant now. Initialize
Sigurður Ásgeirsson
2015/03/11 20:15:31
Done.
|
| + |
| +int g_timeout_in_seconds = kDefaultTimeoutInSeconds; |
|
sky
2015/03/11 19:15:51
This isn't global, it's file local. It should be t
Sigurður Ásgeirsson
2015/03/11 20:15:31
Done.
gab
2015/03/11 20:25:35
Interesting, I've seen g_ prefixes used for file l
sky
2015/03/11 20:27:59
I agree that g_foo is more readable, but it's my t
|
| // The following is copied from net/base/escape.cc. We don't want to depend on |
| // net here because this gets compiled into chrome.exe to facilitate |
| @@ -141,13 +143,9 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window, |
| cds.cbData = static_cast<DWORD>((to_send.length() + 1) * sizeof(wchar_t)); |
| cds.lpData = const_cast<wchar_t*>(to_send.c_str()); |
| DWORD_PTR result = 0; |
| - if (::SendMessageTimeout(remote_window, |
| - WM_COPYDATA, |
| - NULL, |
| - reinterpret_cast<LPARAM>(&cds), |
| - SMTO_ABORTIFHUNG, |
| - kTimeoutInSeconds * 1000, |
| - &result)) { |
| + if (::SendMessageTimeout(remote_window, WM_COPYDATA, NULL, |
| + reinterpret_cast<LPARAM>(&cds), SMTO_ABORTIFHUNG, |
| + g_timeout_in_seconds * 1000, &result)) { |
| return result ? NOTIFY_SUCCESS : NOTIFY_FAILED; |
| } |
| @@ -159,4 +157,10 @@ NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window, |
| return NOTIFY_WINDOW_HUNG; |
| } |
| +int SetNotificationTimeoutInSecondsForTesting(int new_timeout) { |
| + int old_timeout = g_timeout_in_seconds; |
| + g_timeout_in_seconds = new_timeout; |
| + return old_timeout; |
| +} |
| + |
| } // namespace chrome |