| 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 #include "remoting/host/win/worker_process_launcher.h" | 5 #include "remoting/host/win/worker_process_launcher.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 namespace remoting { | 49 namespace remoting { |
| 50 | 50 |
| 51 WorkerProcessLauncher::Delegate::~Delegate() { | 51 WorkerProcessLauncher::Delegate::~Delegate() { |
| 52 } | 52 } |
| 53 | 53 |
| 54 WorkerProcessLauncher::WorkerProcessLauncher( | 54 WorkerProcessLauncher::WorkerProcessLauncher( |
| 55 scoped_ptr<WorkerProcessLauncher::Delegate> launcher_delegate, | 55 scoped_ptr<WorkerProcessLauncher::Delegate> launcher_delegate, |
| 56 WorkerProcessIpcDelegate* ipc_handler) | 56 WorkerProcessIpcDelegate* ipc_handler) |
| 57 : ipc_handler_(ipc_handler), | 57 : ipc_handler_(ipc_handler), |
| 58 launcher_delegate_(launcher_delegate.Pass()), | 58 launcher_delegate_(std::move(launcher_delegate)), |
| 59 exit_code_(CONTROL_C_EXIT), | 59 exit_code_(CONTROL_C_EXIT), |
| 60 ipc_enabled_(false), | 60 ipc_enabled_(false), |
| 61 kill_process_timeout_( | 61 kill_process_timeout_( |
| 62 base::TimeDelta::FromSeconds(kKillProcessTimeoutSeconds)), | 62 base::TimeDelta::FromSeconds(kKillProcessTimeoutSeconds)), |
| 63 launch_backoff_(&kDefaultBackoffPolicy) { | 63 launch_backoff_(&kDefaultBackoffPolicy) { |
| 64 DCHECK(ipc_handler_ != nullptr); | 64 DCHECK(ipc_handler_ != nullptr); |
| 65 | 65 |
| 66 LaunchWorker(); | 66 LaunchWorker(); |
| 67 } | 67 } |
| 68 | 68 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 DCHECK(!launch_timer_.IsRunning()); | 112 DCHECK(!launch_timer_.IsRunning()); |
| 113 DCHECK(!process_watcher_.GetWatchedObject()); | 113 DCHECK(!process_watcher_.GetWatchedObject()); |
| 114 DCHECK(!worker_process_.IsValid()); | 114 DCHECK(!worker_process_.IsValid()); |
| 115 | 115 |
| 116 if (!process_watcher_.StartWatchingOnce(worker_process.Get(), this)) { | 116 if (!process_watcher_.StartWatchingOnce(worker_process.Get(), this)) { |
| 117 StopWorker(); | 117 StopWorker(); |
| 118 return; | 118 return; |
| 119 } | 119 } |
| 120 | 120 |
| 121 ipc_enabled_ = true; | 121 ipc_enabled_ = true; |
| 122 worker_process_ = worker_process.Pass(); | 122 worker_process_ = std::move(worker_process); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void WorkerProcessLauncher::OnFatalError() { | 125 void WorkerProcessLauncher::OnFatalError() { |
| 126 DCHECK(CalledOnValidThread()); | 126 DCHECK(CalledOnValidThread()); |
| 127 | 127 |
| 128 StopWorker(); | 128 StopWorker(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 bool WorkerProcessLauncher::OnMessageReceived( | 131 bool WorkerProcessLauncher::OnMessageReceived( |
| 132 const IPC::Message& message) { | 132 const IPC::Message& message) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 ipc_handler_->OnPermanentError(exit_code_); | 259 ipc_handler_->OnPermanentError(exit_code_); |
| 260 return; | 260 return; |
| 261 } | 261 } |
| 262 | 262 |
| 263 // Schedule the next attempt to launch the worker process. | 263 // Schedule the next attempt to launch the worker process. |
| 264 launch_timer_.Start(FROM_HERE, launch_backoff_.GetTimeUntilRelease(), this, | 264 launch_timer_.Start(FROM_HERE, launch_backoff_.GetTimeUntilRelease(), this, |
| 265 &WorkerProcessLauncher::LaunchWorker); | 265 &WorkerProcessLauncher::LaunchWorker); |
| 266 } | 266 } |
| 267 | 267 |
| 268 } // namespace remoting | 268 } // namespace remoting |
| OLD | NEW |