OLD | NEW |
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 Loading... |
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 #endif | 205 #endif |
206 | 206 |
207 io_task_runner_->PostTask( | 207 io_task_runner_->PostTask( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 int NodeController::MergeLocalPorts(const ports::PortRef& port0, | 285 int NodeController::MergeLocalPorts(const ports::PortRef& port0, |
286 const ports::PortRef& port1) { | 286 const ports::PortRef& port1) { |
287 int rv = node_->MergeLocalPorts(port0, port1); | 287 int rv = node_->MergeLocalPorts(port0, port1); |
288 AcceptIncomingMessages(); | 288 AcceptIncomingMessages(); |
289 return rv; | 289 return rv; |
290 } | 290 } |
291 | 291 |
292 scoped_refptr<PlatformSharedBuffer> NodeController::CreateSharedBuffer( | 292 scoped_refptr<PlatformSharedBuffer> NodeController::CreateSharedBuffer( |
293 size_t num_bytes) { | 293 size_t num_bytes) { |
294 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL) | 294 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL_SFI) |
295 // Shared buffer creation failure is fatal, so always use the broker when we | 295 // Shared buffer creation failure is fatal, so always use the broker when we |
296 // have one. This does mean that a non-root process that has children will use | 296 // have one. This does mean that a non-root process that has children will use |
297 // the broker for shared buffer creation even though that process is | 297 // the broker for shared buffer creation even though that process is |
298 // privileged. | 298 // privileged. |
299 if (broker_) { | 299 if (broker_) { |
300 return broker_->GetSharedBuffer(num_bytes); | 300 return broker_->GetSharedBuffer(num_bytes); |
301 } | 301 } |
302 #endif | 302 #endif |
303 return PlatformSharedBuffer::Create(num_bytes); | 303 return PlatformSharedBuffer::Create(num_bytes); |
304 } | 304 } |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 shutdown_callback_flag_.Set(false); | 1128 shutdown_callback_flag_.Set(false); |
1129 } | 1129 } |
1130 | 1130 |
1131 DCHECK(!callback.is_null()); | 1131 DCHECK(!callback.is_null()); |
1132 | 1132 |
1133 callback.Run(); | 1133 callback.Run(); |
1134 } | 1134 } |
1135 | 1135 |
1136 } // namespace edk | 1136 } // namespace edk |
1137 } // namespace mojo | 1137 } // namespace mojo |
OLD | NEW |