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

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

Issue 1679763002: Clean up public interface of AttachmentBrokerUnprivileged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove CHECK. Created 4 years, 10 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
« no previous file with comments | « remoting/host/desktop_process.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // 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/desktop_process.h" 8 #include "remoting/host/desktop_process.h"
9 9
10 #include <utility> 10 #include <utility>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 void DesktopProcess::OnChannelConnected(int32_t peer_pid) { 77 void DesktopProcess::OnChannelConnected(int32_t peer_pid) {
78 DCHECK(caller_task_runner_->BelongsToCurrentThread()); 78 DCHECK(caller_task_runner_->BelongsToCurrentThread());
79 79
80 VLOG(1) << "IPC: desktop <- daemon (" << peer_pid << ")"; 80 VLOG(1) << "IPC: desktop <- daemon (" << peer_pid << ")";
81 } 81 }
82 82
83 void DesktopProcess::OnChannelError() { 83 void DesktopProcess::OnChannelError() {
84 // Shutdown the desktop process. 84 // Shutdown the desktop process.
85 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
86 if (broker && !broker->IsPrivilegedBroker())
87 broker->DeregisterBrokerCommunicationChannel(daemon_channel_.get());
85 daemon_channel_.reset(); 88 daemon_channel_.reset();
86 if (desktop_agent_.get()) { 89 if (desktop_agent_.get()) {
87 desktop_agent_->Stop(); 90 desktop_agent_->Stop();
88 desktop_agent_ = nullptr; 91 desktop_agent_ = nullptr;
89 } 92 }
90 93
91 caller_task_runner_ = nullptr; 94 caller_task_runner_ = nullptr;
92 input_task_runner_ = nullptr; 95 input_task_runner_ = nullptr;
93 desktop_environment_factory_.reset(); 96 desktop_environment_factory_.reset();
94 } 97 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 input_task_runner_ = nullptr; 137 input_task_runner_ = nullptr;
135 desktop_environment_factory_.reset(); 138 desktop_environment_factory_.reset();
136 return false; 139 return false;
137 } 140 }
138 141
139 // Connect to the daemon. 142 // Connect to the daemon.
140 daemon_channel_ = 143 daemon_channel_ =
141 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT, 144 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT,
142 this, io_task_runner.get()); 145 this, io_task_runner.get());
143 146
144 // Attachment broker may be already created in tests. 147 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded();
145 if (!IPC::AttachmentBroker::GetGlobal()) 148 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
146 attachment_broker_ = IPC::AttachmentBrokerUnprivileged::CreateBroker(); 149 if (broker && !broker->IsPrivilegedBroker())
147 150 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get());
148 if (attachment_broker_) {
149 attachment_broker_->DesignateBrokerCommunicationChannel(
150 daemon_channel_.get());
151 }
152 151
153 // Pass |desktop_pipe| to the daemon. 152 // Pass |desktop_pipe| to the daemon.
154 daemon_channel_->Send( 153 daemon_channel_->Send(
155 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe)); 154 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe));
156 155
157 return true; 156 return true;
158 } 157 }
159 158
160 void DesktopProcess::OnCrash(const std::string& function_name, 159 void DesktopProcess::OnCrash(const std::string& function_name,
161 const std::string& file_name, 160 const std::string& file_name,
162 const int& line_number) { 161 const int& line_number) {
163 char message[1024]; 162 char message[1024];
164 base::snprintf(message, sizeof(message), 163 base::snprintf(message, sizeof(message),
165 "Requested by %s at %s, line %d.", 164 "Requested by %s at %s, line %d.",
166 function_name.c_str(), file_name.c_str(), line_number); 165 function_name.c_str(), file_name.c_str(), line_number);
167 base::debug::Alias(message); 166 base::debug::Alias(message);
168 167
169 // The daemon requested us to crash the process. 168 // The daemon requested us to crash the process.
170 CHECK(false) << message; 169 CHECK(false) << message;
171 } 170 }
172 171
173 } // namespace remoting 172 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/desktop_process.h ('k') | remoting/host/remoting_me2me_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698