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

Unified Diff: mojo/edk/embedder/embedder.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/embedder/connection_param.cc ('k') | mojo/edk/embedder/embedder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « mojo/edk/embedder/connection_param.cc ('k') | mojo/edk/embedder/embedder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698