| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_APP_CHROME_WATCHER_CLIENT_WIN_H_ | 5 #ifndef CHROME_APP_CHROME_WATCHER_CLIENT_WIN_H_ |
| 6 #define CHROME_APP_CHROME_WATCHER_CLIENT_WIN_H_ | 6 #define CHROME_APP_CHROME_WATCHER_CLIENT_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/process/process.h" | 13 #include "base/process/process.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/win/scoped_handle.h" | 15 #include "base/win/scoped_handle.h" |
| 16 | 16 |
| 17 #define DLLEXPORT __declspec(dllexport) |
| 18 |
| 17 // Launches a Chrome watcher process and permits the client to wait until the | 19 // Launches a Chrome watcher process and permits the client to wait until the |
| 18 // process is fully initialized. | 20 // process is fully initialized. |
| 19 class ChromeWatcherClient { | 21 class DLLEXPORT ChromeWatcherClient { |
| 20 public: | 22 public: |
| 21 // A CommandLineGenerator generates command lines that will launch a separate | 23 // A CommandLineGenerator generates command lines that will launch a separate |
| 22 // process and pass the supplied values to WatcherMain in that process. | 24 // process and pass the supplied values to WatcherMain in that process. |
| 23 // |parent_process| is the process that the watcher process should watch; | 25 // |parent_process| is the process that the watcher process should watch; |
| 24 // |main_thread_id| is the parent process' main thread ID. | 26 // |main_thread_id| is the parent process' main thread ID. |
| 25 // |on_initialized_event| should be signaled when the watcher process is fully | 27 // |on_initialized_event| should be signaled when the watcher process is fully |
| 26 // initialized. The process will be launched such that the HANDLEs are | 28 // initialized. The process will be launched such that the HANDLEs are |
| 27 // inherited by the new process. | 29 // inherited by the new process. |
| 28 typedef base::Callback<base::CommandLine(HANDLE parent_process, | 30 typedef base::Callback<base::CommandLine(HANDLE parent_process, |
| 29 DWORD main_thread_id, | 31 DWORD main_thread_id, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 55 bool WaitForExitWithTimeout(base::TimeDelta timeout, int* exit_code); | 57 bool WaitForExitWithTimeout(base::TimeDelta timeout, int* exit_code); |
| 56 | 58 |
| 57 private: | 59 private: |
| 58 CommandLineGenerator command_line_generator_; | 60 CommandLineGenerator command_line_generator_; |
| 59 base::win::ScopedHandle on_initialized_event_; | 61 base::win::ScopedHandle on_initialized_event_; |
| 60 base::Process process_; | 62 base::Process process_; |
| 61 | 63 |
| 62 DISALLOW_COPY_AND_ASSIGN(ChromeWatcherClient); | 64 DISALLOW_COPY_AND_ASSIGN(ChromeWatcherClient); |
| 63 }; | 65 }; |
| 64 | 66 |
| 67 #undef DLLEXPORT |
| 68 |
| 65 #endif // CHROME_APP_CHROME_WATCHER_CLIENT_WIN_H_ | 69 #endif // CHROME_APP_CHROME_WATCHER_CLIENT_WIN_H_ |
| OLD | NEW |