OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_ | 5 #ifndef CHROME_BROWSER_PROCESS_SINGLETON_H_ |
6 #define CHROME_BROWSER_PROCESS_SINGLETON_H_ | 6 #define CHROME_BROWSER_PROCESS_SINGLETON_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 // Returns true if another process was found and notified, false if we should | 98 // Returns true if another process was found and notified, false if we should |
99 // continue with the current process. | 99 // continue with the current process. |
100 // On Windows, Create() has to be called before this. | 100 // On Windows, Create() has to be called before this. |
101 NotifyResult NotifyOtherProcess(); | 101 NotifyResult NotifyOtherProcess(); |
102 | 102 |
103 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 103 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
104 // Exposed for testing. We use a timeout on Linux, and in tests we want | 104 // Exposed for testing. We use a timeout on Linux, and in tests we want |
105 // this timeout to be short. | 105 // this timeout to be short. |
106 NotifyResult NotifyOtherProcessWithTimeout( | 106 NotifyResult NotifyOtherProcessWithTimeout( |
107 const base::CommandLine& command_line, | 107 const base::CommandLine& command_line, |
108 int timeout_seconds, | 108 int retry_attempts, |
109 const base::TimeDelta& timeout_interval, | |
Nico
2014/09/08 19:04:18
nit: i'd just call this timeout I think, the type
mattm
2014/09/09 00:06:14
Done.
| |
109 bool kill_unresponsive); | 110 bool kill_unresponsive); |
110 NotifyResult NotifyOtherProcessWithTimeoutOrCreate( | 111 NotifyResult NotifyOtherProcessWithTimeoutOrCreate( |
111 const base::CommandLine& command_line, | 112 const base::CommandLine& command_line, |
112 int timeout_seconds); | 113 int retry_attempts, |
114 const base::TimeDelta& timeout_interval); | |
113 void OverrideCurrentPidForTesting(base::ProcessId pid); | 115 void OverrideCurrentPidForTesting(base::ProcessId pid); |
114 void OverrideKillCallbackForTesting( | 116 void OverrideKillCallbackForTesting( |
115 const base::Callback<void(int)>& callback); | 117 const base::Callback<void(int)>& callback); |
116 #endif | 118 #endif |
117 | 119 |
118 private: | 120 private: |
119 // Timeout for the current browser process to respond. 20 seconds should be | |
120 // enough. | |
121 static const int kTimeoutInSeconds = 20; | |
122 | |
123 NotificationCallback notification_callback_; // Handler for notifications. | 121 NotificationCallback notification_callback_; // Handler for notifications. |
124 | 122 |
125 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
126 bool EscapeVirtualization(const base::FilePath& user_data_dir); | 124 bool EscapeVirtualization(const base::FilePath& user_data_dir); |
127 | 125 |
128 HWND remote_window_; // The HWND_MESSAGE of another browser. | 126 HWND remote_window_; // The HWND_MESSAGE of another browser. |
129 base::win::MessageWindow window_; // The message-only window. | 127 base::win::MessageWindow window_; // The message-only window. |
130 bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. | 128 bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. |
131 HANDLE lock_file_; | 129 HANDLE lock_file_; |
132 base::FilePath user_data_dir_; | 130 base::FilePath user_data_dir_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 // Helper class for linux specific messages. LinuxWatcher is ref counted | 166 // Helper class for linux specific messages. LinuxWatcher is ref counted |
169 // because it posts messages between threads. | 167 // because it posts messages between threads. |
170 class LinuxWatcher; | 168 class LinuxWatcher; |
171 scoped_refptr<LinuxWatcher> watcher_; | 169 scoped_refptr<LinuxWatcher> watcher_; |
172 #endif | 170 #endif |
173 | 171 |
174 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); | 172 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); |
175 }; | 173 }; |
176 | 174 |
177 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ | 175 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ |
OLD | NEW |