| 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/desktop_session_win.h" | 5 #include "remoting/host/desktop_session_win.h" |
| 6 | 6 |
| 7 #include <sddl.h> | 7 #include <sddl.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 575 |
| 576 // This call will delete |this| so it should be at the very end of the method. | 576 // This call will delete |this| so it should be at the very end of the method. |
| 577 daemon_process()->CloseDesktopSession(id()); | 577 daemon_process()->CloseDesktopSession(id()); |
| 578 } | 578 } |
| 579 | 579 |
| 580 void DesktopSessionWin::OnChannelConnected(int32_t peer_pid) { | 580 void DesktopSessionWin::OnChannelConnected(int32_t peer_pid) { |
| 581 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 581 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 582 | 582 |
| 583 ReportElapsedTime("channel connected"); | 583 ReportElapsedTime("channel connected"); |
| 584 | 584 |
| 585 // Obtain the handle of the desktop process. It will be passed to the network | |
| 586 // process to use to duplicate handles of shared memory objects from | |
| 587 // the desktop process. | |
| 588 desktop_process_.Set(OpenProcess(PROCESS_DUP_HANDLE, false, peer_pid)); | |
| 589 if (!desktop_process_.IsValid()) { | |
| 590 CrashDesktopProcess(FROM_HERE); | |
| 591 return; | |
| 592 } | |
| 593 | |
| 594 VLOG(1) << "IPC: daemon <- desktop (" << peer_pid << ")"; | 585 VLOG(1) << "IPC: daemon <- desktop (" << peer_pid << ")"; |
| 595 } | 586 } |
| 596 | 587 |
| 597 bool DesktopSessionWin::OnMessageReceived(const IPC::Message& message) { | 588 bool DesktopSessionWin::OnMessageReceived(const IPC::Message& message) { |
| 598 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 589 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 599 | 590 |
| 600 bool handled = true; | 591 bool handled = true; |
| 601 IPC_BEGIN_MESSAGE_MAP(DesktopSessionWin, message) | 592 IPC_BEGIN_MESSAGE_MAP(DesktopSessionWin, message) |
| 602 IPC_MESSAGE_HANDLER(ChromotingDesktopDaemonMsg_DesktopAttached, | 593 IPC_MESSAGE_HANDLER(ChromotingDesktopDaemonMsg_DesktopAttached, |
| 603 OnDesktopSessionAgentAttached) | 594 OnDesktopSessionAgentAttached) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 if (monitoring_notifications_) { | 668 if (monitoring_notifications_) { |
| 678 ReportElapsedTime("detached"); | 669 ReportElapsedTime("detached"); |
| 679 | 670 |
| 680 session_attach_timer_.Start( | 671 session_attach_timer_.Start( |
| 681 FROM_HERE, base::TimeDelta::FromSeconds(kSessionAttachTimeoutSeconds), | 672 FROM_HERE, base::TimeDelta::FromSeconds(kSessionAttachTimeoutSeconds), |
| 682 this, &DesktopSessionWin::OnSessionAttachTimeout); | 673 this, &DesktopSessionWin::OnSessionAttachTimeout); |
| 683 } | 674 } |
| 684 } | 675 } |
| 685 | 676 |
| 686 void DesktopSessionWin::OnDesktopSessionAgentAttached( | 677 void DesktopSessionWin::OnDesktopSessionAgentAttached( |
| 687 IPC::PlatformFileForTransit desktop_pipe) { | 678 const IPC::ChannelHandle& desktop_pipe) { |
| 688 if (!daemon_process()->OnDesktopSessionAgentAttached(id(), | 679 if (!daemon_process()->OnDesktopSessionAgentAttached(id(), desktop_pipe)) { |
| 689 desktop_process_.Get(), | |
| 690 desktop_pipe)) { | |
| 691 CrashDesktopProcess(FROM_HERE); | 680 CrashDesktopProcess(FROM_HERE); |
| 692 } | 681 } |
| 693 } | 682 } |
| 694 | 683 |
| 695 void DesktopSessionWin::CrashDesktopProcess( | 684 void DesktopSessionWin::CrashDesktopProcess( |
| 696 const tracked_objects::Location& location) { | 685 const tracked_objects::Location& location) { |
| 697 DCHECK(caller_task_runner_->BelongsToCurrentThread()); | 686 DCHECK(caller_task_runner_->BelongsToCurrentThread()); |
| 698 | 687 |
| 699 launcher_->Crash(location); | 688 launcher_->Crash(location); |
| 700 } | 689 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 716 exploded.hour, | 705 exploded.hour, |
| 717 exploded.minute, | 706 exploded.minute, |
| 718 exploded.second, | 707 exploded.second, |
| 719 exploded.millisecond, | 708 exploded.millisecond, |
| 720 passed.c_str()); | 709 passed.c_str()); |
| 721 | 710 |
| 722 last_timestamp_ = now; | 711 last_timestamp_ = now; |
| 723 } | 712 } |
| 724 | 713 |
| 725 } // namespace remoting | 714 } // namespace remoting |
| OLD | NEW |