Index: mojo/edk/embedder/embedder.cc |
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc |
index d581e65381e676f40a647e338bd1da7c4695b5b9..5b9913abfbc64914e193944b9d9a000cc1062acb 100644 |
--- a/mojo/edk/embedder/embedder.cc |
+++ b/mojo/edk/embedder/embedder.cc |
@@ -21,6 +21,14 @@ |
#include "mojo/edk/system/core.h" |
#include "mojo/edk/system/node_controller.h" |
+#if defined(OS_ANDROID) |
+#include "base/android/global_object_registry.h" |
+#include "base/android/jni_android.h" |
+#include "base/android/parcelable_channel_client.h" |
+#include "base/android/parcelable_channel_server.h" |
+#include "base/android/scoped_java_ref.h" |
+#endif |
+ |
#if !defined(OS_NACL) |
#include "crypto/random.h" |
#endif |
@@ -31,6 +39,13 @@ namespace edk { |
class Core; |
class PlatformSupport; |
+namespace { |
+#if defined(OS_ANDROID) |
+const int kParcelableChannelClientID = 1; |
+const int kParcelableChannelServerID = 2; |
+#endif |
+} // namespace |
+ |
namespace internal { |
Core* g_core; |
@@ -44,7 +59,22 @@ void SetMaxMessageSize(size_t bytes) { |
void SetParentPipeHandle(ScopedPlatformHandle pipe) { |
CHECK(internal::g_core); |
- internal::g_core->InitChild(std::move(pipe)); |
+#if defined(OS_ANDROID) |
+ base::android::GlobalObjectRegistry* object_registry = |
+ base::android::GlobalObjectRegistry::GetInstance(); |
+ |
+ base::android::ParcelableChannelClient parcelable_channel_client( |
+ object_registry->Take(kParcelableChannelClientID)); |
+ base::android::ParcelableChannelServer parcelable_channel_server( |
+ object_registry->Take(kParcelableChannelServerID)); |
+ |
+ ConnectionParam connection_param(std::move(pipe), |
+ std::move(parcelable_channel_client), |
+ std::move(parcelable_channel_server)); |
+#else |
+ ConnectionParam connection_param(std::move(pipe)); |
+#endif |
+ internal::g_core->InitChild(std::move(connection_param)); |
} |
void SetParentPipeHandleFromCommandLine() { |