| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/arc_bridge_bootstrap.h" | 5 #include "components/arc/arc_bridge_bootstrap.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <grp.h> | 8 #include <grp.h> |
| 9 #include <unistd.h> | 9 #include <unistd.h> |
| 10 | 10 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 int raw_fd = -1; | 248 int raw_fd = -1; |
| 249 if (!IPC::ServerAcceptConnection(socket_fd.get(), &raw_fd)) { | 249 if (!IPC::ServerAcceptConnection(socket_fd.get(), &raw_fd)) { |
| 250 return base::ScopedFD(); | 250 return base::ScopedFD(); |
| 251 } | 251 } |
| 252 base::ScopedFD scoped_fd(raw_fd); | 252 base::ScopedFD scoped_fd(raw_fd); |
| 253 | 253 |
| 254 // Hardcode pid 0 since it is unused in mojo. | 254 // Hardcode pid 0 since it is unused in mojo. |
| 255 const base::ProcessHandle kUnusedChildProcessHandle = 0; | 255 const base::ProcessHandle kUnusedChildProcessHandle = 0; |
| 256 mojo::edk::PlatformChannelPair channel_pair; | 256 mojo::edk::PlatformChannelPair channel_pair; |
| 257 mojo::edk::ChildProcessLaunched(kUnusedChildProcessHandle, | 257 mojo::edk::ChildProcessLaunched(kUnusedChildProcessHandle, |
| 258 channel_pair.PassServerHandle()); | 258 channel_pair.PassServerHandle(), |
| 259 mojo::edk::GenerateRandomToken()); |
| 259 | 260 |
| 260 mojo::edk::ScopedPlatformHandleVectorPtr handles( | 261 mojo::edk::ScopedPlatformHandleVectorPtr handles( |
| 261 new mojo::edk::PlatformHandleVector{ | 262 new mojo::edk::PlatformHandleVector{ |
| 262 channel_pair.PassClientHandle().release()}); | 263 channel_pair.PassClientHandle().release()}); |
| 263 | 264 |
| 264 struct iovec iov = {const_cast<char*>(""), 1}; | 265 struct iovec iov = {const_cast<char*>(""), 1}; |
| 265 ssize_t result = mojo::edk::PlatformChannelSendmsgWithHandles( | 266 ssize_t result = mojo::edk::PlatformChannelSendmsgWithHandles( |
| 266 mojo::edk::PlatformHandle(scoped_fd.get()), &iov, 1, handles->data(), | 267 mojo::edk::PlatformHandle(scoped_fd.get()), &iov, 1, handles->data(), |
| 267 handles->size()); | 268 handles->size()); |
| 268 if (result == -1) { | 269 if (result == -1) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 336 } |
| 336 | 337 |
| 337 } // namespace | 338 } // namespace |
| 338 | 339 |
| 339 // static | 340 // static |
| 340 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 341 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
| 341 return base::WrapUnique(new ArcBridgeBootstrapImpl()); | 342 return base::WrapUnique(new ArcBridgeBootstrapImpl()); |
| 342 } | 343 } |
| 343 | 344 |
| 344 } // namespace arc | 345 } // namespace arc |
| OLD | NEW |