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

Side by Side Diff: mojo/edk/embedder/platform_channel_pair_android.cc

Issue 2549363004: Multiprocess test client: Android child process launcher rework. (Closed)
Patch Set: Fixed tests Created 4 years 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
Ken Rockot(use gerrit already) 2016/12/12 22:23:08 nit: I think it might be less confusing to just lu
Jay Civelli 2016/12/13 18:23:25 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/edk/embedder/platform_channel_pair.h"
6
7 #include "base/posix/global_descriptors.h"
8 #include "base/strings/string_number_conversions.h"
9
10 namespace mojo {
11 namespace edk {
12
13 std::string
14 PlatformChannelPair::PrepareToPassClientHandleToChildProcessAsString(
15 HandlePassingInformation* handle_passing_info) const {
16 int fd = client_handle_.get().handle;
17 base::GlobalDescriptors::Key fd_id =
18 base::GlobalDescriptors::GetInstance()->Register(fd);
19 handle_passing_info->push_back(std::pair<int, int>(fd, fd_id));
20 return base::UintToString(fd_id);
21 }
22
23 // static
24 ScopedPlatformHandle
25 PlatformChannelPair::PassClientHandleFromParentProcessFromString(
26 const std::string& value) {
27 base::GlobalDescriptors::Key fd_id = -1;
28 if (value.empty() || !base::StringToUint(value, &fd_id)) {
29 LOG(ERROR) << "Missing or invalid --" << kMojoPlatformChannelHandleSwitch;
30 return ScopedPlatformHandle();
31 }
32 int fd = base::GlobalDescriptors::GetInstance()->Get(fd_id);
33 return ScopedPlatformHandle(PlatformHandle(fd));
34 }
35
36 } // namespace edk
37 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698