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

Unified Diff: mojo/shell/android/apk/src/org/chromium/mojo/shell/Bootstrap.java

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 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
Index: mojo/shell/android/apk/src/org/chromium/mojo/shell/Bootstrap.java
diff --git a/mojo/shell/android/apk/src/org/chromium/mojo/shell/Bootstrap.java b/mojo/shell/android/apk/src/org/chromium/mojo/shell/Bootstrap.java
new file mode 100644
index 0000000000000000000000000000000000000000..9916c8312f10e2ce82b2986dfe3abc20e1a59f11
--- /dev/null
+++ b/mojo/shell/android/apk/src/org/chromium/mojo/shell/Bootstrap.java
@@ -0,0 +1,45 @@
+// Copyright 2014 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.chromium.mojo.shell;
+
+import android.content.Context;
+
+import org.chromium.base.JNINamespace;
+
+import java.io.File;
+
+/**
+ * Runnable used to bootstrap execution of Android Mojo application. For the JNI to work, we need a
+ * Java class with the application classloader in the call stack. We load this class in the
+ * application classloader and call into native from it to achieve that.
+ */
+@JNINamespace("mojo::shell")
+public class Bootstrap implements Runnable {
+ private final Context mContext;
+ private final File mBootstrapNativeLibrary;
+ private final File mApplicationNativeLibrary;
+ private final int mHandle;
+ private final long mRunApplicationPtr;
+
+ public Bootstrap(Context context, File bootstrapNativeLibrary, File applicationNativeLibrary,
+ Integer handle, Long runApplicationPtr) {
+ mContext = context;
+ mBootstrapNativeLibrary = bootstrapNativeLibrary;
+ mApplicationNativeLibrary = applicationNativeLibrary;
+ mHandle = handle;
+ mRunApplicationPtr = runApplicationPtr;
+ }
+
+ @Override
+ public void run() {
+ System.load(mBootstrapNativeLibrary.getAbsolutePath());
+ System.load(mApplicationNativeLibrary.getAbsolutePath());
+ nativeBootstrap(mContext, mApplicationNativeLibrary.getAbsolutePath(), mHandle,
+ mRunApplicationPtr);
+ }
+
+ native void nativeBootstrap(Context context, String libraryPath, int handle,
+ long runApplicationPtr);
+}

Powered by Google App Engine
This is Rietveld 408576698