| 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 REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ | 5 #ifndef REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ |
| 6 #define REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ | 6 #define REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/sequence_checker.h" | 17 #include "base/sequence_checker.h" |
| 17 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 18 #include "base/win/object_watcher.h" | 19 #include "base/win/object_watcher.h" |
| 19 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
| 20 #include "net/base/backoff_entry.h" | 21 #include "net/base/backoff_entry.h" |
| 21 | 22 |
| 22 namespace base { | 23 namespace base { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // The delegate must guarantee that no other notifications are delivered once | 91 // The delegate must guarantee that no other notifications are delivered once |
| 91 // OnFatalError() has been called. | 92 // OnFatalError() has been called. |
| 92 void OnFatalError(); | 93 void OnFatalError(); |
| 93 | 94 |
| 94 // Mirrors methods of IPC::Listener to be invoked by |Delegate|. |Delegate| | 95 // Mirrors methods of IPC::Listener to be invoked by |Delegate|. |Delegate| |
| 95 // has to validate |peer_pid| if necessary. | 96 // has to validate |peer_pid| if necessary. |
| 96 bool OnMessageReceived(const IPC::Message& message); | 97 bool OnMessageReceived(const IPC::Message& message); |
| 97 void OnChannelConnected(int32_t peer_pid); | 98 void OnChannelConnected(int32_t peer_pid); |
| 98 void OnChannelError(); | 99 void OnChannelError(); |
| 99 | 100 |
| 101 // Appends extra command line switches to |command_line|. |
| 102 void AppendSwitches(base::CommandLine* command_line) const; |
| 103 |
| 100 private: | 104 private: |
| 101 friend class WorkerProcessLauncherTest; | 105 friend class WorkerProcessLauncherTest; |
| 102 | 106 |
| 103 // base::win::ObjectWatcher::Delegate implementation used to watch for | 107 // base::win::ObjectWatcher::Delegate implementation used to watch for |
| 104 // the worker process exiting. | 108 // the worker process exiting. |
| 105 void OnObjectSignaled(HANDLE object) override; | 109 void OnObjectSignaled(HANDLE object) override; |
| 106 | 110 |
| 107 // Returns true when the object is being destroyed. | 111 // Returns true when the object is being destroyed. |
| 108 bool stopping() const { return ipc_handler_ == nullptr; } | 112 bool stopping() const { return ipc_handler_ == nullptr; } |
| 109 | 113 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // terminates. | 158 // terminates. |
| 155 base::win::ObjectWatcher process_watcher_; | 159 base::win::ObjectWatcher process_watcher_; |
| 156 | 160 |
| 157 // Timer used to detect whether a launch attempt was successful or not, and to | 161 // Timer used to detect whether a launch attempt was successful or not, and to |
| 158 // cancel the launch attempt if it is taking too long. | 162 // cancel the launch attempt if it is taking too long. |
| 159 base::OneShotTimer launch_result_timer_; | 163 base::OneShotTimer launch_result_timer_; |
| 160 | 164 |
| 161 // The handle of the worker process, if launched. | 165 // The handle of the worker process, if launched. |
| 162 base::win::ScopedHandle worker_process_; | 166 base::win::ScopedHandle worker_process_; |
| 163 | 167 |
| 168 // How many times the process has been started. |
| 169 int start_counter_ = 0; |
| 170 |
| 164 SEQUENCE_CHECKER(sequence_checker_); | 171 SEQUENCE_CHECKER(sequence_checker_); |
| 165 | 172 |
| 166 DISALLOW_COPY_AND_ASSIGN(WorkerProcessLauncher); | 173 DISALLOW_COPY_AND_ASSIGN(WorkerProcessLauncher); |
| 167 }; | 174 }; |
| 168 | 175 |
| 169 } // namespace remoting | 176 } // namespace remoting |
| 170 | 177 |
| 171 #endif // REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ | 178 #endif // REMOTING_HOST_WIN_WORKER_PROCESS_LAUNCHER_H_ |
| OLD | NEW |