Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: remoting/host/daemon_process_win.cc

Issue 12545006: The worker process launcher can now ask the worker to crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/daemon_process.h" 5 #include "remoting/host/daemon_process.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/process.h" 14 #include "base/process.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "base/time.h" 16 #include "base/time.h"
16 #include "base/timer.h" 17 #include "base/timer.h"
17 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
18 #include "base/win/scoped_handle.h" 19 #include "base/win/scoped_handle.h"
19 #include "ipc/ipc_message.h" 20 #include "ipc/ipc_message.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::ProcessHandle desktop_process, 59 base::ProcessHandle desktop_process,
59 IPC::PlatformFileForTransit desktop_pipe) OVERRIDE; 60 IPC::PlatformFileForTransit desktop_pipe) OVERRIDE;
60 61
61 protected: 62 protected:
62 // Stoppable implementation. 63 // Stoppable implementation.
63 virtual void DoStop() OVERRIDE; 64 virtual void DoStop() OVERRIDE;
64 65
65 // DaemonProcess implementation. 66 // DaemonProcess implementation.
66 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( 67 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession(
67 int terminal_id) OVERRIDE; 68 int terminal_id) OVERRIDE;
69 virtual void DoCrashNetworkProcess(
70 const tracked_objects::Location& location) OVERRIDE;
68 virtual void LaunchNetworkProcess() OVERRIDE; 71 virtual void LaunchNetworkProcess() OVERRIDE;
69 72
70 private: 73 private:
71 scoped_ptr<WorkerProcessLauncher> network_launcher_; 74 scoped_ptr<WorkerProcessLauncher> network_launcher_;
72 75
73 // Handle of the network process. 76 // Handle of the network process.
74 ScopedHandle network_process_; 77 ScopedHandle network_process_;
75 78
76 DISALLOW_COPY_AND_ASSIGN(DaemonProcessWin); 79 DISALLOW_COPY_AND_ASSIGN(DaemonProcessWin);
77 }; 80 };
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 145
143 scoped_ptr<DesktopSession> DaemonProcessWin::DoCreateDesktopSession( 146 scoped_ptr<DesktopSession> DaemonProcessWin::DoCreateDesktopSession(
144 int terminal_id) { 147 int terminal_id) {
145 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 148 DCHECK(caller_task_runner()->BelongsToCurrentThread());
146 149
147 return scoped_ptr<DesktopSession>(new DesktopSessionWin( 150 return scoped_ptr<DesktopSession>(new DesktopSessionWin(
148 caller_task_runner(), io_task_runner(), this, terminal_id, 151 caller_task_runner(), io_task_runner(), this, terminal_id,
149 HostService::GetInstance())); 152 HostService::GetInstance()));
150 } 153 }
151 154
155 void DaemonProcessWin::DoCrashNetworkProcess(
156 const tracked_objects::Location& location) {
157 DCHECK(caller_task_runner()->BelongsToCurrentThread());
158
159 network_launcher_->Crash(location);
160 }
161
152 void DaemonProcessWin::LaunchNetworkProcess() { 162 void DaemonProcessWin::LaunchNetworkProcess() {
153 DCHECK(caller_task_runner()->BelongsToCurrentThread()); 163 DCHECK(caller_task_runner()->BelongsToCurrentThread());
154 DCHECK(!network_launcher_); 164 DCHECK(!network_launcher_);
155 165
156 // Construct the host binary name. 166 // Construct the host binary name.
157 base::FilePath host_binary; 167 base::FilePath host_binary;
158 if (!GetInstalledBinaryPath(kHostBinaryName, &host_binary)) { 168 if (!GetInstalledBinaryPath(kHostBinaryName, &host_binary)) {
159 Stop(); 169 Stop();
160 return; 170 return;
161 } 171 }
(...skipping 16 matching lines...) Expand all
178 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 188 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
179 const base::Closure& stopped_callback) { 189 const base::Closure& stopped_callback) {
180 scoped_ptr<DaemonProcessWin> daemon_process( 190 scoped_ptr<DaemonProcessWin> daemon_process(
181 new DaemonProcessWin(caller_task_runner, io_task_runner, 191 new DaemonProcessWin(caller_task_runner, io_task_runner,
182 stopped_callback)); 192 stopped_callback));
183 daemon_process->Initialize(); 193 daemon_process->Initialize();
184 return daemon_process.PassAs<DaemonProcess>(); 194 return daemon_process.PassAs<DaemonProcess>();
185 } 195 }
186 196
187 } // namespace remoting 197 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698