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

Side by Side Diff: mojo/edk/system/node_controller.cc

Issue 2071143003: Various changes to make Mojo work under NaCl non-sfi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and comment Created 4 years, 6 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 | « mojo/edk/system/node_controller.h ('k') | mojo/mojo_edk.gypi » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "mojo/edk/system/node_controller.h" 5 #include "mojo/edk/system/node_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 for (const auto& port : ports_to_close) 188 for (const auto& port : ports_to_close)
189 node_->ClosePort(port); 189 node_->ClosePort(port);
190 190
191 // Ensure local port closure messages are processed. 191 // Ensure local port closure messages are processed.
192 AcceptIncomingMessages(); 192 AcceptIncomingMessages();
193 } 193 }
194 194
195 void NodeController::ConnectToParent(ScopedPlatformHandle platform_handle) { 195 void NodeController::ConnectToParent(ScopedPlatformHandle platform_handle) {
196 // TODO(amistry): Consider the need for a broker on Windows. 196 // TODO(amistry): Consider the need for a broker on Windows.
197 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL) 197 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL_SFI)
198 // On posix, use the bootstrap channel for the broker and receive the node's 198 // On posix, use the bootstrap channel for the broker and receive the node's
199 // channel synchronously as the first message from the broker. 199 // channel synchronously as the first message from the broker.
200 base::ElapsedTimer timer; 200 base::ElapsedTimer timer;
201 broker_.reset(new Broker(std::move(platform_handle))); 201 broker_.reset(new Broker(std::move(platform_handle)));
202 platform_handle = broker_->GetParentPlatformHandle(); 202 platform_handle = broker_->GetParentPlatformHandle();
203 UMA_HISTOGRAM_TIMES("Mojo.System.GetParentPlatformHandleSyncTime", 203 UMA_HISTOGRAM_TIMES("Mojo.System.GetParentPlatformHandleSyncTime",
204 timer.Elapsed()); 204 timer.Elapsed());
205 205
206 if (!platform_handle.is_valid()) { 206 if (!platform_handle.is_valid()) {
207 // Most likely the browser side of the channel has already been closed and 207 // Most likely the browser side of the channel has already been closed and
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 int NodeController::MergeLocalPorts(const ports::PortRef& port0, 293 int NodeController::MergeLocalPorts(const ports::PortRef& port0,
294 const ports::PortRef& port1) { 294 const ports::PortRef& port1) {
295 int rv = node_->MergeLocalPorts(port0, port1); 295 int rv = node_->MergeLocalPorts(port0, port1);
296 AcceptIncomingMessages(); 296 AcceptIncomingMessages();
297 return rv; 297 return rv;
298 } 298 }
299 299
300 scoped_refptr<PlatformSharedBuffer> NodeController::CreateSharedBuffer( 300 scoped_refptr<PlatformSharedBuffer> NodeController::CreateSharedBuffer(
301 size_t num_bytes) { 301 size_t num_bytes) {
302 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL) 302 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL_SFI)
303 // Shared buffer creation failure is fatal, so always use the broker when we 303 // Shared buffer creation failure is fatal, so always use the broker when we
304 // have one. This does mean that a non-root process that has children will use 304 // have one. This does mean that a non-root process that has children will use
305 // the broker for shared buffer creation even though that process is 305 // the broker for shared buffer creation even though that process is
306 // privileged. 306 // privileged.
307 if (broker_) { 307 if (broker_) {
308 return broker_->GetSharedBuffer(num_bytes); 308 return broker_->GetSharedBuffer(num_bytes);
309 } 309 }
310 #endif 310 #endif
311 return PlatformSharedBuffer::Create(num_bytes); 311 return PlatformSharedBuffer::Create(num_bytes);
312 } 312 }
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 shutdown_callback_flag_.Set(false); 1136 shutdown_callback_flag_.Set(false);
1137 } 1137 }
1138 1138
1139 DCHECK(!callback.is_null()); 1139 DCHECK(!callback.is_null());
1140 1140
1141 callback.Run(); 1141 callback.Run();
1142 } 1142 }
1143 1143
1144 } // namespace edk 1144 } // namespace edk
1145 } // namespace mojo 1145 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/node_controller.h ('k') | mojo/mojo_edk.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698