| Index: mojo/shell/android/bootstrap.cc
|
| diff --git a/mojo/shell/android/bootstrap.cc b/mojo/shell/android/bootstrap.cc
|
| index 13ad33a2a26760d4dd5f1d2495ddd83279edd1b0..73eab93501f4c9aff9c694d791640b3ddbe77a58 100644
|
| --- a/mojo/shell/android/bootstrap.cc
|
| +++ b/mojo/shell/android/bootstrap.cc
|
| @@ -6,58 +6,22 @@
|
| #include "base/android/jni_string.h"
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| -#include "base/scoped_native_library.h"
|
| #include "jni/Bootstrap_jni.h"
|
| -#include "mojo/shell/dynamic_service_runner.h"
|
| +#include "mojo/shell/android/run_android_application_function.h"
|
|
|
| namespace mojo {
|
|
|
| -namespace {
|
| -// Most applications will need to access the Android ApplicationContext in which
|
| -// they are run. If the application library exports the InitApplicationContext
|
| -// function, we will set it there.
|
| -void SetApplicationContextIfNeeded(
|
| - JNIEnv* env,
|
| - const base::ScopedNativeLibrary& app_library,
|
| - jobject context) {
|
| - const char* init_application_context_name = "InitApplicationContext";
|
| - typedef void (*InitApplicationContextFn)(
|
| - const base::android::JavaRef<jobject>&);
|
| - InitApplicationContextFn init_application_context =
|
| - reinterpret_cast<InitApplicationContextFn>(
|
| - app_library.GetFunctionPointer(init_application_context_name));
|
| - if (init_application_context) {
|
| - base::android::ScopedJavaLocalRef<jobject> scoped_context(env, context);
|
| - init_application_context(scoped_context);
|
| - }
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| void Bootstrap(JNIEnv* env,
|
| jobject,
|
| jobject j_context,
|
| jstring j_native_library_path,
|
| - jint j_handle) {
|
| + jint j_handle,
|
| + jlong j_run_application_ptr) {
|
| base::FilePath app_path(
|
| base::android::ConvertJavaStringToUTF8(env, j_native_library_path));
|
| - ScopedMessagePipeHandle handle((mojo::MessagePipeHandle(j_handle)));
|
| -
|
| - // Load the library, so that we can set the application context there if
|
| - // needed.
|
| - base::NativeLibraryLoadError error;
|
| - base::ScopedNativeLibrary app_library(
|
| - base::LoadNativeLibrary(app_path, &error));
|
| - if (!app_library.is_valid()) {
|
| - LOG(ERROR) << "Failed to load app library (error: " << error.ToString()
|
| - << ")";
|
| - return;
|
| - }
|
| - SetApplicationContextIfNeeded(env, app_library, j_context);
|
| -
|
| - // Run the application.
|
| - base::ScopedNativeLibrary app_library_from_runner(
|
| - shell::DynamicServiceRunner::LoadAndRunService(app_path, handle.Pass()));
|
| + RunAndroidApplicationFn run_android_application_fn =
|
| + reinterpret_cast<RunAndroidApplicationFn>(j_run_application_ptr);
|
| + run_android_application_fn(env, j_context, app_path, j_handle);
|
| }
|
|
|
| bool RegisterBootstrapJni(JNIEnv* env) {
|
|
|