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

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

Issue 2424353002: Use ChannelMojo between the remoting daemon and network processes. (Closed)
Patch Set: Created 4 years, 2 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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/base_switches.h" 12 #include "base/base_switches.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/process/process.h" 19 #include "base/process/process.h"
20 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
21 #include "base/strings/utf_string_conversions.h" 21 #include "base/strings/utf_string_conversions.h"
22 #include "base/time/time.h" 22 #include "base/time/time.h"
23 #include "base/win/registry.h" 23 #include "base/win/registry.h"
24 #include "base/win/scoped_handle.h" 24 #include "base/win/scoped_handle.h"
25 #include "base/win/win_util.h" 25 #include "base/win/win_util.h"
26 #include "ipc/ipc_message.h" 26 #include "ipc/ipc_message.h"
27 #include "ipc/ipc_message_macros.h" 27 #include "ipc/ipc_message_macros.h"
28 #include "mojo/edk/embedder/scoped_ipc_support.h"
28 #include "remoting/base/auto_thread_task_runner.h" 29 #include "remoting/base/auto_thread_task_runner.h"
29 #include "remoting/base/scoped_sc_handle_win.h" 30 #include "remoting/base/scoped_sc_handle_win.h"
30 #include "remoting/host/branding.h" 31 #include "remoting/host/branding.h"
31 #include "remoting/host/chromoting_messages.h" 32 #include "remoting/host/chromoting_messages.h"
32 #include "remoting/host/desktop_session_win.h" 33 #include "remoting/host/desktop_session_win.h"
33 #include "remoting/host/host_exit_codes.h" 34 #include "remoting/host/host_exit_codes.h"
34 #include "remoting/host/host_main.h" 35 #include "remoting/host/host_main.h"
35 #include "remoting/host/ipc_constants.h" 36 #include "remoting/host/ipc_constants.h"
36 #include "remoting/host/pairing_registry_delegate_win.h" 37 #include "remoting/host/pairing_registry_delegate_win.h"
37 #include "remoting/host/screen_resolution.h" 38 #include "remoting/host/screen_resolution.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 void DisableAutoStart(); 99 void DisableAutoStart();
99 100
100 // Initializes the pairing registry on the host side by sending 101 // Initializes the pairing registry on the host side by sending
101 // ChromotingDaemonNetworkMsg_InitializePairingRegistry message. 102 // ChromotingDaemonNetworkMsg_InitializePairingRegistry message.
102 bool InitializePairingRegistry(); 103 bool InitializePairingRegistry();
103 104
104 // Opens the pairing registry keys. 105 // Opens the pairing registry keys.
105 bool OpenPairingRegistry(); 106 bool OpenPairingRegistry();
106 107
107 private: 108 private:
109 mojo::edk::ScopedIPCSupport ipc_support_;
110
108 std::unique_ptr<WorkerProcessLauncher> network_launcher_; 111 std::unique_ptr<WorkerProcessLauncher> network_launcher_;
109 112
110 // Handle of the network process. 113 // Handle of the network process.
111 ScopedHandle network_process_; 114 ScopedHandle network_process_;
112 115
113 base::win::RegKey pairing_registry_privileged_key_; 116 base::win::RegKey pairing_registry_privileged_key_;
114 base::win::RegKey pairing_registry_unprivileged_key_; 117 base::win::RegKey pairing_registry_unprivileged_key_;
115 118
116 DISALLOW_COPY_AND_ASSIGN(DaemonProcessWin); 119 DISALLOW_COPY_AND_ASSIGN(DaemonProcessWin);
117 }; 120 };
118 121
119 DaemonProcessWin::DaemonProcessWin( 122 DaemonProcessWin::DaemonProcessWin(
120 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, 123 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
121 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 124 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
122 const base::Closure& stopped_callback) 125 const base::Closure& stopped_callback)
123 : DaemonProcess(caller_task_runner, io_task_runner, stopped_callback) { 126 : DaemonProcess(caller_task_runner, io_task_runner, stopped_callback),
124 } 127 // Mojo holds onto the task runner forever so ignore it when deciding when
128 // to shut down.
joedow 2016/10/20 17:40:03 I'd move this comment to the declaration of the me
Sam McNally 2016/10/20 22:40:22 Done.
129 ipc_support_(io_task_runner->underlying_task_runner()) {}
125 130
126 DaemonProcessWin::~DaemonProcessWin() { 131 DaemonProcessWin::~DaemonProcessWin() {
127 } 132 }
128 133
129 void DaemonProcessWin::OnChannelConnected(int32_t peer_pid) { 134 void DaemonProcessWin::OnChannelConnected(int32_t peer_pid) {
130 // Obtain the handle of the network process. 135 // Obtain the handle of the network process.
131 network_process_.Set(OpenProcess(PROCESS_DUP_HANDLE, false, peer_pid)); 136 network_process_.Set(OpenProcess(PROCESS_DUP_HANDLE, false, peer_pid));
132 if (!network_process_.IsValid()) { 137 if (!network_process_.IsValid()) {
133 CrashNetworkProcess(FROM_HERE); 138 CrashNetworkProcess(FROM_HERE);
134 return; 139 return;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 << "\\" << kPairingRegistrySecretsKeyName; 384 << "\\" << kPairingRegistrySecretsKeyName;
380 return false; 385 return false;
381 } 386 }
382 387
383 pairing_registry_privileged_key_.Set(privileged.Take()); 388 pairing_registry_privileged_key_.Set(privileged.Take());
384 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); 389 pairing_registry_unprivileged_key_.Set(unprivileged.Take());
385 return true; 390 return true;
386 } 391 }
387 392
388 } // namespace remoting 393 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698