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

Side by Side Diff: components/arc/arc_bridge_bootstrap.cc

Issue 2019973002: [mojo-edk] Bind a child token to child launches and port reservations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/test/base/mojo_test_connector.cc ('k') | content/browser/browser_child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698