OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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 #ifndef COMPONENTS_BROWSER_WATCHER_EXIT_CODE_WATCHER_WIN_H_ | 4 #ifndef COMPONENTS_BROWSER_WATCHER_EXIT_CODE_WATCHER_WIN_H_ |
5 #define COMPONENTS_BROWSER_WATCHER_EXIT_CODE_WATCHER_WIN_H_ | 5 #define COMPONENTS_BROWSER_WATCHER_EXIT_CODE_WATCHER_WIN_H_ |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/process/process.h" | 8 #include "base/process/process.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // It checks the handle for validity and takes ownership of it. | 34 // It checks the handle for validity and takes ownership of it. |
35 // The intent is for this handle to be inherited into the watcher process | 35 // The intent is for this handle to be inherited into the watcher process |
36 // hosting the instance of this class. | 36 // hosting the instance of this class. |
37 bool ParseArguments(const base::CommandLine& cmd_line); | 37 bool ParseArguments(const base::CommandLine& cmd_line); |
38 | 38 |
39 // Waits for the process to exit and records its exit code in registry. | 39 // Waits for the process to exit and records its exit code in registry. |
40 // This is a blocking call. | 40 // This is a blocking call. |
41 void WaitForExit(); | 41 void WaitForExit(); |
42 | 42 |
43 const base::Process& process() const { return process_; } | 43 const base::Process& process() const { return process_; } |
| 44 int exit_code() const { return exit_code_; } |
44 | 45 |
45 private: | 46 private: |
46 // Writes |exit_code| to registry, returns true on success. | 47 // Writes |exit_code| to registry, returns true on success. |
47 bool WriteProcessExitCode(int exit_code); | 48 bool WriteProcessExitCode(int exit_code); |
48 | 49 |
49 // The registry path the exit codes are written to. | 50 // The registry path the exit codes are written to. |
50 base::string16 registry_path_; | 51 base::string16 registry_path_; |
51 | 52 |
52 // Handle, PID, and creation time of the watched process. | 53 // Watched process and its creation time. |
53 base::Process process_; | 54 base::Process process_; |
54 base::Time process_creation_time_; | 55 base::Time process_creation_time_; |
55 | 56 |
| 57 // The exit code of the watched process. Valid after WaitForExit. |
| 58 int exit_code_; |
| 59 |
56 DISALLOW_COPY_AND_ASSIGN(ExitCodeWatcher); | 60 DISALLOW_COPY_AND_ASSIGN(ExitCodeWatcher); |
57 }; | 61 }; |
58 | 62 |
59 } // namespace browser_watcher | 63 } // namespace browser_watcher |
60 | 64 |
61 #endif // COMPONENTS_BROWSER_WATCHER_EXIT_CODE_WATCHER_WIN_H_ | 65 #endif // COMPONENTS_BROWSER_WATCHER_EXIT_CODE_WATCHER_WIN_H_ |
OLD | NEW |