Index: mojo/edk/embedder/platform_handle.h |
diff --git a/mojo/edk/embedder/platform_handle.h b/mojo/edk/embedder/platform_handle.h |
index 4866e754fd1376579a06333d4d49d331cd9c33bc..59ae8c7614943bccecf1af58784de2befeb6785e 100644 |
--- a/mojo/edk/embedder/platform_handle.h |
+++ b/mojo/edk/embedder/platform_handle.h |
@@ -14,6 +14,9 @@ |
#include "base/process/process_handle.h" |
#elif defined(OS_MACOSX) && !defined(OS_IOS) |
#include <mach/mach.h> |
+#elif defined(OS_ANDROID) |
+#include <jni.h> |
+#include "base/android/scoped_java_ref.h" |
#endif |
namespace mojo { |
@@ -27,6 +30,11 @@ struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { |
explicit PlatformHandle(mach_port_t port) |
: type(Type::MACH), port(port) {} |
#endif |
+#if defined(OS_ANDROID) |
+ explicit PlatformHandle( |
+ const base::android::ScopedJavaLocalRef<jobject>& parcelable_param) |
+ : type(Type::PARCELABLE), parcelable(parcelable_param) {} |
+#endif |
void CloseIfNecessary(); |
@@ -35,6 +43,10 @@ struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { |
if (type == Type::MACH || type == Type::MACH_NAME) |
return port != MACH_PORT_NULL; |
#endif |
+#if defined(OS_ANDROID) |
+ if (type == Type::PARCELABLE) // || type == Type::PARCELABLE_ID) |
+ return !parcelable.is_null(); |
+#endif |
return handle != -1; |
} |
@@ -48,6 +60,10 @@ struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { |
// this also allows us to do checks in other places. |
MACH_NAME, |
#endif |
+#if defined(OS_ANDROID) |
+ PARCELABLE, |
+// PARCELABLE_ID, |
+#endif |
}; |
Type type = Type::POSIX; |
@@ -59,6 +75,9 @@ struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { |
#if defined(OS_MACOSX) && !defined(OS_IOS) |
mach_port_t port = MACH_PORT_NULL; |
#endif |
+#if defined(OS_ANDROID) |
+ base::android::ScopedJavaGlobalRef<jobject> parcelable; |
+#endif |
}; |
#elif defined(OS_WIN) |
struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle { |