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

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

Issue 11118005: Pass the client end handle of the network-to-daemon IPC channel via handle inheritance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | 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/logging.h" 10 #include "base/logging.h"
(...skipping 11 matching lines...) Expand all
22 #include "remoting/host/win/worker_process_launcher.h" 22 #include "remoting/host/win/worker_process_launcher.h"
23 23
24 using base::win::ScopedHandle; 24 using base::win::ScopedHandle;
25 using base::TimeDelta; 25 using base::TimeDelta;
26 26
27 namespace { 27 namespace {
28 28
29 const FilePath::CharType kMe2meHostBinaryName[] = 29 const FilePath::CharType kMe2meHostBinaryName[] =
30 FILE_PATH_LITERAL("remoting_host.exe"); 30 FILE_PATH_LITERAL("remoting_host.exe");
31 31
32 // The security descriptor of the daemon IPC endpoint. It gives full access
33 // to LocalSystem and denies access by anyone else.
34 const char kDaemonPipeSecurityDescriptor[] = "O:SYG:SYD:(A;;GA;;;SY)";
35
36 } // namespace 32 } // namespace
37 33
38 namespace remoting { 34 namespace remoting {
39 35
40 class DaemonProcessWin : public DaemonProcess { 36 class DaemonProcessWin : public DaemonProcess {
41 public: 37 public:
42 DaemonProcessWin(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 38 DaemonProcessWin(scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
43 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 39 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
44 const base::Closure& stopped_callback); 40 const base::Closure& stopped_callback);
45 virtual ~DaemonProcessWin(); 41 virtual ~DaemonProcessWin();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 FilePath dir_path; 79 FilePath dir_path;
84 if (!PathService::Get(base::DIR_EXE, &dir_path)) { 80 if (!PathService::Get(base::DIR_EXE, &dir_path)) {
85 LOG(ERROR) << "Failed to get the executable file name."; 81 LOG(ERROR) << "Failed to get the executable file name.";
86 Stop(); 82 Stop();
87 return; 83 return;
88 } 84 }
89 85
90 scoped_ptr<UnprivilegedProcessDelegate> delegate( 86 scoped_ptr<UnprivilegedProcessDelegate> delegate(
91 new UnprivilegedProcessDelegate(main_task_runner(), io_task_runner(), 87 new UnprivilegedProcessDelegate(main_task_runner(), io_task_runner(),
92 dir_path.Append(kMe2meHostBinaryName))); 88 dir_path.Append(kMe2meHostBinaryName)));
93 launcher_.reset(new WorkerProcessLauncher(main_task_runner(), 89 launcher_.reset(new WorkerProcessLauncher(
94 io_task_runner(), 90 main_task_runner(), delegate.Pass(), this));
95 delegate.Pass(),
96 this,
97 kDaemonPipeSecurityDescriptor));
98 } 91 }
99 92
100 void DaemonProcessWin::Send(IPC::Message* message) { 93 void DaemonProcessWin::Send(IPC::Message* message) {
101 if (launcher_.get() != NULL) { 94 if (launcher_.get() != NULL) {
102 launcher_->Send(message); 95 launcher_->Send(message);
103 } else { 96 } else {
104 delete message; 97 delete message;
105 } 98 }
106 } 99 }
107 100
108 void DaemonProcessWin::DoStop() { 101 void DaemonProcessWin::DoStop() {
109 DCHECK(main_task_runner()->BelongsToCurrentThread()); 102 DCHECK(main_task_runner()->BelongsToCurrentThread());
110 103
111 launcher_.reset(); 104 launcher_.reset();
112 DaemonProcess::DoStop(); 105 DaemonProcess::DoStop();
113 } 106 }
114 107
115 scoped_ptr<DaemonProcess> DaemonProcess::Create( 108 scoped_ptr<DaemonProcess> DaemonProcess::Create(
116 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 109 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
117 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, 110 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
118 const base::Closure& stopped_callback) { 111 const base::Closure& stopped_callback) {
119 scoped_ptr<DaemonProcessWin> daemon_process( 112 scoped_ptr<DaemonProcessWin> daemon_process(
120 new DaemonProcessWin(main_task_runner, io_task_runner, stopped_callback)); 113 new DaemonProcessWin(main_task_runner, io_task_runner, stopped_callback));
121 return daemon_process.PassAs<DaemonProcess>(); 114 return daemon_process.PassAs<DaemonProcess>();
122 } 115 }
123 116
124 } // namespace remoting 117 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/remoting_me2me_host.cc » ('j') | remoting/host/remoting_me2me_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698