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

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

Issue 1704743002: Revert of Clean up public interface of AttachmentBrokerUnprivileged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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());
88 daemon_channel_.reset(); 85 daemon_channel_.reset();
89 if (desktop_agent_.get()) { 86 if (desktop_agent_.get()) {
90 desktop_agent_->Stop(); 87 desktop_agent_->Stop();
91 desktop_agent_ = nullptr; 88 desktop_agent_ = nullptr;
92 } 89 }
93 90
94 caller_task_runner_ = nullptr; 91 caller_task_runner_ = nullptr;
95 input_task_runner_ = nullptr; 92 input_task_runner_ = nullptr;
96 desktop_environment_factory_.reset(); 93 desktop_environment_factory_.reset();
97 } 94 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 input_task_runner_ = nullptr; 134 input_task_runner_ = nullptr;
138 desktop_environment_factory_.reset(); 135 desktop_environment_factory_.reset();
139 return false; 136 return false;
140 } 137 }
141 138
142 // Connect to the daemon. 139 // Connect to the daemon.
143 daemon_channel_ = 140 daemon_channel_ =
144 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT, 141 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT,
145 this, io_task_runner.get()); 142 this, io_task_runner.get());
146 143
147 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded(); 144 // Attachment broker may be already created in tests.
148 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); 145 if (!IPC::AttachmentBroker::GetGlobal())
149 if (broker && !broker->IsPrivilegedBroker()) 146 attachment_broker_ = IPC::AttachmentBrokerUnprivileged::CreateBroker();
150 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get()); 147
148 if (attachment_broker_) {
149 attachment_broker_->DesignateBrokerCommunicationChannel(
150 daemon_channel_.get());
151 }
151 152
152 // Pass |desktop_pipe| to the daemon. 153 // Pass |desktop_pipe| to the daemon.
153 daemon_channel_->Send( 154 daemon_channel_->Send(
154 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe)); 155 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe));
155 156
156 return true; 157 return true;
157 } 158 }
158 159
159 void DesktopProcess::OnCrash(const std::string& function_name, 160 void DesktopProcess::OnCrash(const std::string& function_name,
160 const std::string& file_name, 161 const std::string& file_name,
161 const int& line_number) { 162 const int& line_number) {
162 char message[1024]; 163 char message[1024];
163 base::snprintf(message, sizeof(message), 164 base::snprintf(message, sizeof(message),
164 "Requested by %s at %s, line %d.", 165 "Requested by %s at %s, line %d.",
165 function_name.c_str(), file_name.c_str(), line_number); 166 function_name.c_str(), file_name.c_str(), line_number);
166 base::debug::Alias(message); 167 base::debug::Alias(message);
167 168
168 // The daemon requested us to crash the process. 169 // The daemon requested us to crash the process.
169 CHECK(false) << message; 170 CHECK(false) << message;
170 } 171 }
171 172
172 } // namespace remoting 173 } // 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