Chromium Code Reviews| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 // this method, only callers for whom failure is preferred to notifying | 85 // this method, only callers for whom failure is preferred to notifying |
| 86 // another process should call this directly. | 86 // another process should call this directly. |
| 87 bool Create(); | 87 bool Create(); |
| 88 | 88 |
| 89 // Clear any lock state during shutdown. | 89 // Clear any lock state during shutdown. |
| 90 void Cleanup(); | 90 void Cleanup(); |
| 91 | 91 |
| 92 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 92 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 93 static void DisablePromptForTesting(); | 93 static void DisablePromptForTesting(); |
| 94 #endif | 94 #endif |
| 95 #if defined(OS_WIN) | |
| 96 typedef base::Callback<bool()> DisplayShouldKillMessageBoxCallback; | |
|
gab
2015/03/11 13:20:39
Add a comment to explain what it means for this ca
gab
2015/03/11 13:20:39
New C++11 syntax is prefered these days, i.e.:
us
Sigurður Ásgeirsson
2015/03/11 14:32:37
Done.
Sigurður Ásgeirsson
2015/03/11 14:32:37
Done.
| |
| 97 void OverrideKillMessageBoxCallbackForTesting( | |
| 98 const DisplayShouldKillMessageBoxCallback& display_dialog_callback); | |
| 99 #endif | |
| 95 | 100 |
| 96 protected: | 101 protected: |
| 97 // Notify another process, if available. | 102 // Notify another process, if available. |
| 98 // Returns true if another process was found and notified, false if we should | 103 // Returns true if another process was found and notified, false if we should |
| 99 // continue with the current process. | 104 // continue with the current process. |
| 100 // On Windows, Create() has to be called before this. | 105 // On Windows, Create() has to be called before this. |
| 101 NotifyResult NotifyOtherProcess(); | 106 NotifyResult NotifyOtherProcess(); |
| 102 | 107 |
| 103 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 108 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 104 // Exposed for testing. We use a timeout on Linux, and in tests we want | 109 // Exposed for testing. We use a timeout on Linux, and in tests we want |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 121 NotificationCallback notification_callback_; // Handler for notifications. | 126 NotificationCallback notification_callback_; // Handler for notifications. |
| 122 | 127 |
| 123 #if defined(OS_WIN) | 128 #if defined(OS_WIN) |
| 124 bool EscapeVirtualization(const base::FilePath& user_data_dir); | 129 bool EscapeVirtualization(const base::FilePath& user_data_dir); |
| 125 | 130 |
| 126 HWND remote_window_; // The HWND_MESSAGE of another browser. | 131 HWND remote_window_; // The HWND_MESSAGE of another browser. |
| 127 base::win::MessageWindow window_; // The message-only window. | 132 base::win::MessageWindow window_; // The message-only window. |
| 128 bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. | 133 bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment. |
| 129 HANDLE lock_file_; | 134 HANDLE lock_file_; |
| 130 base::FilePath user_data_dir_; | 135 base::FilePath user_data_dir_; |
| 136 DisplayShouldKillMessageBoxCallback display_should_kill_messagebox_callback_; | |
| 131 #elif defined(OS_POSIX) && !defined(OS_ANDROID) | 137 #elif defined(OS_POSIX) && !defined(OS_ANDROID) |
| 132 // Return true if the given pid is one of our child processes. | 138 // Return true if the given pid is one of our child processes. |
| 133 // Assumes that the current pid is the root of all pids of the current | 139 // Assumes that the current pid is the root of all pids of the current |
| 134 // instance. | 140 // instance. |
| 135 bool IsSameChromeInstance(pid_t pid); | 141 bool IsSameChromeInstance(pid_t pid); |
| 136 | 142 |
| 137 // Extract the process's pid from a symbol link path and if it is on | 143 // Extract the process's pid from a symbol link path and if it is on |
| 138 // the same host, kill the process, unlink the lock file and return true. | 144 // the same host, kill the process, unlink the lock file and return true. |
| 139 // If the process is part of the same chrome instance, unlink the lock file | 145 // If the process is part of the same chrome instance, unlink the lock file |
| 140 // and return true without killing it. | 146 // and return true without killing it. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 166 // Helper class for linux specific messages. LinuxWatcher is ref counted | 172 // Helper class for linux specific messages. LinuxWatcher is ref counted |
| 167 // because it posts messages between threads. | 173 // because it posts messages between threads. |
| 168 class LinuxWatcher; | 174 class LinuxWatcher; |
| 169 scoped_refptr<LinuxWatcher> watcher_; | 175 scoped_refptr<LinuxWatcher> watcher_; |
| 170 #endif | 176 #endif |
| 171 | 177 |
| 172 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); | 178 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); |
| 173 }; | 179 }; |
| 174 | 180 |
| 175 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ | 181 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ |
| OLD | NEW |