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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 base::Bind(&ArcBridgeBootstrapImpl::AcceptInstanceConnection, | 275 base::Bind(&ArcBridgeBootstrapImpl::AcceptInstanceConnection, |
276 base::Passed(&socket_fd)), | 276 base::Passed(&socket_fd)), |
277 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceConnected, | 277 base::Bind(&ArcBridgeBootstrapImpl::OnInstanceConnected, |
278 weak_factory_.GetWeakPtr())); | 278 weak_factory_.GetWeakPtr())); |
279 } | 279 } |
280 | 280 |
281 // static | 281 // static |
282 base::ScopedFD ArcBridgeBootstrapImpl::AcceptInstanceConnection( | 282 base::ScopedFD ArcBridgeBootstrapImpl::AcceptInstanceConnection( |
283 base::ScopedFD socket_fd) { | 283 base::ScopedFD socket_fd) { |
284 int raw_fd = -1; | 284 int raw_fd = -1; |
285 if (!IPC::ServerAcceptConnection(socket_fd.get(), &raw_fd)) { | 285 if (!IPC::ServerOnConnect(socket_fd.get(), &raw_fd)) { |
286 return base::ScopedFD(); | 286 return base::ScopedFD(); |
287 } | 287 } |
288 base::ScopedFD scoped_fd(raw_fd); | 288 base::ScopedFD scoped_fd(raw_fd); |
289 | 289 |
290 // Hardcode pid 0 since it is unused in mojo. | 290 // Hardcode pid 0 since it is unused in mojo. |
291 const base::ProcessHandle kUnusedChildProcessHandle = 0; | 291 const base::ProcessHandle kUnusedChildProcessHandle = 0; |
292 mojo::edk::PlatformChannelPair channel_pair; | 292 mojo::edk::PlatformChannelPair channel_pair; |
293 mojo::edk::ChildProcessLaunched(kUnusedChildProcessHandle, | 293 mojo::edk::ChildProcessLaunched(kUnusedChildProcessHandle, |
294 channel_pair.PassServerHandle(), | 294 channel_pair.PassServerHandle(), |
295 mojo::edk::GenerateRandomToken()); | 295 mojo::edk::GenerateRandomToken()); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 372 } |
373 | 373 |
374 } // namespace | 374 } // namespace |
375 | 375 |
376 // static | 376 // static |
377 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { | 377 std::unique_ptr<ArcBridgeBootstrap> ArcBridgeBootstrap::Create() { |
378 return base::WrapUnique(new ArcBridgeBootstrapImpl()); | 378 return base::WrapUnique(new ArcBridgeBootstrapImpl()); |
379 } | 379 } |
380 | 380 |
381 } // namespace arc | 381 } // namespace arc |
OLD | NEW |