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

Side by Side Diff: mojo/public/cpp/system/platform_handle.h

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 years, 9 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
« no previous file with comments | « mojo/public/c/system/platform_handle.h ('k') | mojo/public/cpp/system/platform_handle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file provides a C++ wrapping around the Mojo C API for platform handles, 5 // This file provides a C++ wrapping around the Mojo C API for platform handles,
6 // replacing the prefix of "Mojo" with a "mojo" namespace. 6 // replacing the prefix of "Mojo" with a "mojo" namespace.
7 // 7 //
8 // Please see "mojo/public/c/system/platform_handle.h" for complete 8 // Please see "mojo/public/c/system/platform_handle.h" for complete
9 // documentation of the API. 9 // documentation of the API.
10 10
11 #ifndef MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_ 11 #ifndef MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_
12 #define MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_ 12 #define MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_
13 13
14 #include <stdint.h> 14 #include <stdint.h>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/files/file.h" 17 #include "base/files/file.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/shared_memory_handle.h" 20 #include "base/memory/shared_memory_handle.h"
21 #include "base/process/process_handle.h" 21 #include "base/process/process_handle.h"
22 #include "mojo/public/c/system/platform_handle.h" 22 #include "mojo/public/c/system/platform_handle.h"
23 #include "mojo/public/cpp/system/buffer.h" 23 #include "mojo/public/cpp/system/buffer.h"
24 #include "mojo/public/cpp/system/handle.h" 24 #include "mojo/public/cpp/system/handle.h"
25 #include "mojo/public/cpp/system/system_export.h" 25 #include "mojo/public/cpp/system/system_export.h"
26 26
27 #if defined(OS_ANDROID)
28 #include "base/android/scoped_java_ref.h"
29 #endif
30
27 #if defined(OS_WIN) 31 #if defined(OS_WIN)
28 #include <windows.h> 32 #include <windows.h>
29 #endif 33 #endif
30 34
31 namespace mojo { 35 namespace mojo {
32 36
33 #if defined(OS_POSIX) 37 #if defined(OS_POSIX)
34 const MojoPlatformHandleType kPlatformFileHandleType = 38 const MojoPlatformHandleType kPlatformFileHandleType =
35 MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR; 39 MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR;
36 40
37 #if defined(OS_MACOSX) && !defined(OS_IOS) 41 #if defined(OS_MACOSX) && !defined(OS_IOS)
38 const MojoPlatformHandleType kPlatformSharedBufferHandleType = 42 const MojoPlatformHandleType kPlatformSharedBufferHandleType =
39 MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT; 43 MOJO_PLATFORM_HANDLE_TYPE_MACH_PORT;
40 #else 44 #else
41 const MojoPlatformHandleType kPlatformSharedBufferHandleType = 45 const MojoPlatformHandleType kPlatformSharedBufferHandleType =
42 MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR; 46 MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR;
43 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 47 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
44 48
49 #if defined(OS_ANDROID)
50 const MojoPlatformHandleType kPlatformParcelableType =
51 MOJO_PLATFORM_HANDLE_TYPE_PARCELABLE;
52
53 #endif // defined(OS_ANDROID)
54
45 #elif defined(OS_WIN) 55 #elif defined(OS_WIN)
46 const MojoPlatformHandleType kPlatformFileHandleType = 56 const MojoPlatformHandleType kPlatformFileHandleType =
47 MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE; 57 MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE;
48 58
49 const MojoPlatformHandleType kPlatformSharedBufferHandleType = 59 const MojoPlatformHandleType kPlatformSharedBufferHandleType =
50 MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE; 60 MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE;
51 #endif // defined(OS_POSIX) 61 #endif // defined(OS_POSIX)
52 62
53 // Wraps a PlatformFile as a Mojo handle. Takes ownership of the file object. 63 // Wraps a PlatformFile as a Mojo handle. Takes ownership of the file object.
54 MOJO_CPP_SYSTEM_EXPORT 64 MOJO_CPP_SYSTEM_EXPORT
(...skipping 25 matching lines...) Expand all
80 // Wraps a mach_port_t as a Mojo handle. This takes a reference to the 90 // Wraps a mach_port_t as a Mojo handle. This takes a reference to the
81 // Mach port. 91 // Mach port.
82 MOJO_CPP_SYSTEM_EXPORT ScopedHandle WrapMachPort(mach_port_t port); 92 MOJO_CPP_SYSTEM_EXPORT ScopedHandle WrapMachPort(mach_port_t port);
83 93
84 // Unwraps a mach_port_t from a Mojo handle. The caller gets ownership of the 94 // Unwraps a mach_port_t from a Mojo handle. The caller gets ownership of the
85 // Mach port. 95 // Mach port.
86 MOJO_CPP_SYSTEM_EXPORT MojoResult UnwrapMachPort(ScopedHandle handle, 96 MOJO_CPP_SYSTEM_EXPORT MojoResult UnwrapMachPort(ScopedHandle handle,
87 mach_port_t* port); 97 mach_port_t* port);
88 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 98 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
89 99
100 #if defined(OS_ANDROID)
101 MOJO_CPP_SYSTEM_EXPORT ScopedHandle
102 WrapParcelable(base::android::ScopedJavaLocalRef<jobject> parcelable);
103
104 MOJO_CPP_SYSTEM_EXPORT MojoResult
105 UnwrapParcelable(ScopedHandle handle,
106 base::android::ScopedJavaLocalRef<jobject>* parcelable);
107 #endif
108
90 } // namespace mojo 109 } // namespace mojo
91 110
92 #endif // MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_ 111 #endif // MOJO_PUBLIC_CPP_SYSTEM_PLATFORM_HANDLE_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/platform_handle.h ('k') | mojo/public/cpp/system/platform_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698