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

Unified Diff: sky/shell/apk/src/org/domokit/sky/shell/JavaServiceProvider.java

Issue 936883002: Connect Sky and Ganesh in SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address review comments Created 5 years, 10 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 | « sky/shell/BUILD.gn ('k') | sky/shell/apk/src/org/domokit/sky/shell/PlatformView.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/shell/apk/src/org/domokit/sky/shell/JavaServiceProvider.java
diff --git a/sky/shell/apk/src/org/domokit/sky/shell/JavaServiceProvider.java b/sky/shell/apk/src/org/domokit/sky/shell/JavaServiceProvider.java
new file mode 100644
index 0000000000000000000000000000000000000000..e78f53c0deb9de725e8ff7f5ba6bc5b9c3572f0e
--- /dev/null
+++ b/sky/shell/apk/src/org/domokit/sky/shell/JavaServiceProvider.java
@@ -0,0 +1,47 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.domokit.sky.shell;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+import org.chromium.mojo.system.Core;
+import org.chromium.mojo.system.MessagePipeHandle;
+import org.chromium.mojo.system.MojoException;
+import org.chromium.mojo.system.Pair;
+import org.chromium.mojo.system.impl.CoreImpl;
+import org.chromium.mojom.mojo.ServiceProvider;
+
+/**
+ * A class to intialize the network.
+ **/
+@JNINamespace("sky::shell")
+public class JavaServiceProvider implements ServiceProvider {
+ private Core mCore;
+
+ @SuppressWarnings("unused")
+ @CalledByNative
+ public static int create() {
+ Core core = CoreImpl.getInstance();
+ Pair<MessagePipeHandle, MessagePipeHandle> messagePipe = core.createMessagePipe(null);
+ ServiceProvider.MANAGER.bind(new JavaServiceProvider(core), messagePipe.first);
+ return messagePipe.second.releaseNativeHandle();
+ }
+
+ public JavaServiceProvider(Core core) {
+ assert core != null;
+ mCore = core;
+ }
+
+ @Override
+ public void close() {}
+
+ @Override
+ public void onConnectionError(MojoException e) {}
+
+ @Override
+ public void connectToService(String interfaceName, MessagePipeHandle pipe) {
+ pipe.close();
+ }
+}
« no previous file with comments | « sky/shell/BUILD.gn ('k') | sky/shell/apk/src/org/domokit/sky/shell/PlatformView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698