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 // This file implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
6 // running within user sessions. | 6 // running within user sessions. |
7 | 7 |
8 #include "remoting/host/win/wts_session_process_delegate.h" | 8 #include "remoting/host/win/wts_session_process_delegate.h" |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 | 375 |
376 // Create the server end of the IPC channel. | 376 // Create the server end of the IPC channel. |
377 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); | 377 std::string channel_name = IPC::Channel::GenerateUniqueRandomChannelID(); |
378 ScopedHandle pipe; | 378 ScopedHandle pipe; |
379 if (!CreateIpcChannel(channel_name, channel_security_, &pipe)) { | 379 if (!CreateIpcChannel(channel_name, channel_security_, &pipe)) { |
380 ReportFatalError(); | 380 ReportFatalError(); |
381 return; | 381 return; |
382 } | 382 } |
383 | 383 |
384 // Wrap the pipe into an IPC channel. | 384 // Wrap the pipe into an IPC channel. |
385 std::unique_ptr<IPC::ChannelProxy> channel(IPC::ChannelProxy::Create( | 385 std::unique_ptr<IPC::ChannelProxy> channel( |
386 IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, this, | 386 new IPC::ChannelProxy(this, io_task_runner_)); |
387 io_task_runner_)); | 387 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
| 388 channel.get(), io_task_runner_); |
| 389 channel->Init(IPC::ChannelHandle(pipe.Get()), IPC::Channel::MODE_SERVER, |
| 390 true); |
388 | 391 |
389 // Pass the name of the IPC channel to use. | 392 // Pass the name of the IPC channel to use. |
390 command_line.AppendSwitchNative(kDaemonPipeSwitchName, | 393 command_line.AppendSwitchNative(kDaemonPipeSwitchName, |
391 base::UTF8ToWide(channel_name)); | 394 base::UTF8ToWide(channel_name)); |
392 | 395 |
393 // Try to launch the process. | 396 // Try to launch the process. |
394 ScopedHandle worker_process; | 397 ScopedHandle worker_process; |
395 ScopedHandle worker_thread; | 398 ScopedHandle worker_thread; |
396 if (!LaunchProcessWithToken(command_line.GetProgram(), | 399 if (!LaunchProcessWithToken(command_line.GetProgram(), |
397 command_line.GetCommandLineString(), | 400 command_line.GetCommandLineString(), |
(...skipping 19 matching lines...) Expand all Loading... |
417 | 420 |
418 if (!ResumeThread(worker_thread.Get())) { | 421 if (!ResumeThread(worker_thread.Get())) { |
419 PLOG(ERROR) << "Failed to resume the worker thread"; | 422 PLOG(ERROR) << "Failed to resume the worker thread"; |
420 ReportFatalError(); | 423 ReportFatalError(); |
421 return; | 424 return; |
422 } | 425 } |
423 | 426 |
424 channel_ = std::move(channel); | 427 channel_ = std::move(channel); |
425 pipe_ = std::move(pipe); | 428 pipe_ = std::move(pipe); |
426 | 429 |
427 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | |
428 channel_.get(), io_task_runner_); | |
429 | |
430 // Report success if the worker process is lauched directly. Otherwise, PID of | 430 // Report success if the worker process is lauched directly. Otherwise, PID of |
431 // the client connected to the pipe will be used later. See | 431 // the client connected to the pipe will be used later. See |
432 // OnChannelConnected(). | 432 // OnChannelConnected(). |
433 if (!launch_elevated_) | 433 if (!launch_elevated_) |
434 ReportProcessLaunched(std::move(worker_process)); | 434 ReportProcessLaunched(std::move(worker_process)); |
435 } | 435 } |
436 | 436 |
437 void WtsSessionProcessDelegate::Core::DrainJobNotifications() { | 437 void WtsSessionProcessDelegate::Core::DrainJobNotifications() { |
438 DCHECK(io_task_runner_->BelongsToCurrentThread()); | 438 DCHECK(io_task_runner_->BelongsToCurrentThread()); |
439 | 439 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 553 |
554 void WtsSessionProcessDelegate::CloseChannel() { | 554 void WtsSessionProcessDelegate::CloseChannel() { |
555 core_->CloseChannel(); | 555 core_->CloseChannel(); |
556 } | 556 } |
557 | 557 |
558 void WtsSessionProcessDelegate::KillProcess() { | 558 void WtsSessionProcessDelegate::KillProcess() { |
559 core_->KillProcess(); | 559 core_->KillProcess(); |
560 } | 560 } |
561 | 561 |
562 } // namespace remoting | 562 } // namespace remoting |
OLD | NEW |