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

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

Issue 1903663004: IPC: Fix attachment brokering race condition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (scoped_ptr->std::unique_ptr) Created 4 years, 7 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 | « ipc/mojo/ipc_channel_mojo.cc ('k') | remoting/host/desktop_session_agent.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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 IPC::PlatformFileForTransit desktop_pipe; 133 IPC::PlatformFileForTransit desktop_pipe;
134 if (!desktop_agent_->Start(AsWeakPtr(), &desktop_pipe)) { 134 if (!desktop_agent_->Start(AsWeakPtr(), &desktop_pipe)) {
135 desktop_agent_ = nullptr; 135 desktop_agent_ = nullptr;
136 caller_task_runner_ = nullptr; 136 caller_task_runner_ = nullptr;
137 input_task_runner_ = nullptr; 137 input_task_runner_ = nullptr;
138 desktop_environment_factory_.reset(); 138 desktop_environment_factory_.reset();
139 return false; 139 return false;
140 } 140 }
141 141
142 // Connect to the daemon. 142 // Connect to the daemon.
143 daemon_channel_ = 143 daemon_channel_.reset(new IPC::ChannelProxy(this, io_task_runner.get()));
144 IPC::ChannelProxy::Create(daemon_channel_name_, IPC::Channel::MODE_CLIENT,
145 this, io_task_runner.get());
146
147 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded(); 144 IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded();
148 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal(); 145 IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
149 if (broker && !broker->IsPrivilegedBroker()) 146 if (broker && !broker->IsPrivilegedBroker())
150 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get()); 147 broker->RegisterBrokerCommunicationChannel(daemon_channel_.get());
148 daemon_channel_->Init(daemon_channel_name_, IPC::Channel::MODE_CLIENT, true);
151 149
152 // Pass |desktop_pipe| to the daemon. 150 // Pass |desktop_pipe| to the daemon.
153 daemon_channel_->Send( 151 daemon_channel_->Send(
154 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe)); 152 new ChromotingDesktopDaemonMsg_DesktopAttached(desktop_pipe));
155 153
156 return true; 154 return true;
157 } 155 }
158 156
159 void DesktopProcess::OnCrash(const std::string& function_name, 157 void DesktopProcess::OnCrash(const std::string& function_name,
160 const std::string& file_name, 158 const std::string& file_name,
161 const int& line_number) { 159 const int& line_number) {
162 char message[1024]; 160 char message[1024];
163 base::snprintf(message, sizeof(message), 161 base::snprintf(message, sizeof(message),
164 "Requested by %s at %s, line %d.", 162 "Requested by %s at %s, line %d.",
165 function_name.c_str(), file_name.c_str(), line_number); 163 function_name.c_str(), file_name.c_str(), line_number);
166 base::debug::Alias(message); 164 base::debug::Alias(message);
167 165
168 // The daemon requested us to crash the process. 166 // The daemon requested us to crash the process.
169 CHECK(false) << message; 167 CHECK(false) << message;
170 } 168 }
171 169
172 } // namespace remoting 170 } // namespace remoting
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_channel_mojo.cc ('k') | remoting/host/desktop_session_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698