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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 // each other. It is named according to the user data directory, so | 42 // each other. It is named according to the user data directory, so |
| 43 // we can be sure that no more than one copy of the application can be | 43 // we can be sure that no more than one copy of the application can be |
| 44 // running at once with a given data directory. | 44 // running at once with a given data directory. |
| 45 // | 45 // |
| 46 // Implementation notes: | 46 // Implementation notes: |
| 47 // - the Windows implementation uses an invisible global message window; | 47 // - the Windows implementation uses an invisible global message window; |
| 48 // - the Linux implementation uses a Unix domain socket in the user data dir. | 48 // - the Linux implementation uses a Unix domain socket in the user data dir. |
| 49 | 49 |
| 50 class ProcessSingleton : public base::NonThreadSafe { | 50 class ProcessSingleton : public base::NonThreadSafe { |
| 51 public: | 51 public: |
| 52 // Used to send the reason of remote hang process termination as histogram. | |
| 53 enum RemoteHungProcessTerminateReason { | |
| 54 #if defined(OS_WIN) | |
| 55 USER_ACCEPTED_TERMINATION = 1, | |
| 56 NO_VISIBLE_WINDOW_FOUND = 2, | |
| 57 #elif defined(OS_POSIX) | |
| 58 NOTIFY_ATTEMPTS_EXCEEDED = 3, | |
| 59 SOCKET_WRITE_FAILED = 4, | |
| 60 SOCKET_READ_FAILED = 5, | |
| 61 #endif | |
| 62 REMOTE_HUNG_PROCESS_TERMINATE_REASON_COUNT = 6 | |
| 63 }; | |
| 64 | |
| 65 // Used to send the result of interaction with remote process as histograms in | |
| 66 // case when remote process influences on start. | |
| 67 enum RemoteProcessInteractionResult { | |
| 68 TERMINATE_SUCCEEDED = 0, | |
| 69 TERMINATE_FAILED = 1, | |
| 70 REMOTE_PROCESS_NOT_FOUND = 2, | |
| 71 #if defined(OS_WIN) | |
| 72 TERMINATE_WAIT_TIMEOUT = 3, | |
| 73 RUNNING_PROCESS_NOTIFY_ERROR = 4, | |
| 74 #elif defined(OS_POSIX) | |
| 75 TERMINATE_NOT_ENOUGH_PERMISSIONS = 5, | |
|
gab
2017/05/12 18:40:59
Why are some terminate histograms here instead of
Alexey Seren
2017/05/15 08:40:48
"RemoteProcessInteractionResult" histogram tracks
| |
| 76 REMOTE_PROCESS_SHUTTING_DOWN = 6, | |
| 77 PROFILE_UNLOCKED = 7, | |
| 78 FAILED_TO_EXTRACT_PID = 8, | |
| 79 INVALID_LOCK_FILE = 9, | |
| 80 ORPHANED_LOCK_FILE = 10, | |
| 81 SAME_BROWSER_INSTANCE = 11, | |
| 82 #endif | |
| 83 REMOTE_PROCESS_INTERACTION_RESULT_COUNT = 12 | |
| 84 }; | |
| 85 | |
| 52 // Logged as histograms, do not modify these values. | 86 // Logged as histograms, do not modify these values. |
| 53 enum NotifyResult { | 87 enum NotifyResult { |
| 54 PROCESS_NONE = 0, | 88 PROCESS_NONE = 0, |
| 55 PROCESS_NOTIFIED = 1, | 89 PROCESS_NOTIFIED = 1, |
| 56 PROFILE_IN_USE = 2, | 90 PROFILE_IN_USE = 2, |
| 57 LOCK_ERROR = 3, | 91 LOCK_ERROR = 3, |
| 58 LAST_VALUE = LOCK_ERROR | 92 LAST_VALUE = LOCK_ERROR |
| 59 }; | 93 }; |
| 60 | 94 |
| 61 static constexpr int kNumNotifyResults = LAST_VALUE + 1; | 95 static constexpr int kNumNotifyResults = LAST_VALUE + 1; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 // Helper class for linux specific messages. LinuxWatcher is ref counted | 212 // Helper class for linux specific messages. LinuxWatcher is ref counted |
| 179 // because it posts messages between threads. | 213 // because it posts messages between threads. |
| 180 class LinuxWatcher; | 214 class LinuxWatcher; |
| 181 scoped_refptr<LinuxWatcher> watcher_; | 215 scoped_refptr<LinuxWatcher> watcher_; |
| 182 #endif | 216 #endif |
| 183 | 217 |
| 184 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); | 218 DISALLOW_COPY_AND_ASSIGN(ProcessSingleton); |
| 185 }; | 219 }; |
| 186 | 220 |
| 187 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ | 221 #endif // CHROME_BROWSER_PROCESS_SINGLETON_H_ |
| OLD | NEW |