forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.cc
44 lines (36 loc) · 1.32 KB
/
bootstrap.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// 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.
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "jni/Bootstrap_jni.h"
#include "mojo/runner/android/run_android_application_function.h"
namespace mojo {
namespace runner {
void Bootstrap(JNIEnv* env,
jobject,
jobject j_context,
jstring j_native_library_path,
jint j_handle,
jlong j_run_application_ptr,
jboolean is_cached_app) {
base::FilePath app_path(
base::android::ConvertJavaStringToUTF8(env, j_native_library_path));
RunAndroidApplicationFn run_android_application_fn =
reinterpret_cast<RunAndroidApplicationFn>(j_run_application_ptr);
run_android_application_fn(env, j_context, app_path, j_handle, is_cached_app);
}
bool RegisterBootstrapJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}
} // namespace runner
} // namespace mojo
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
if (!mojo::runner::RegisterBootstrapJni(env))
return -1;
return JNI_VERSION_1_4;
}