1 // Copyright 2014 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include <jni.h> 6 7 #include "base/android/base_jni_onload.h" 8 #include "base/android/jni_android.h" 9 #include "base/android/jni_registrar.h" 10 #include "base/android/library_loader/library_loader_hooks.h" 11 12 // This is called by the VM when the shared library is first loaded. 13 // Checks the available version of JNI. Also, caches Java reflection artifacts. JNI_OnLoad(JavaVM * vm,void * reserved)14extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) { 15 base::android::InitVM(vm); 16 if (!base::android::OnJNIOnLoadInit()) { 17 return -1; 18 } 19 return JNI_VERSION_1_6; 20 } 21 JNI_OnUnLoad(JavaVM * vm,void * reserved)22extern "C" void JNI_OnUnLoad(JavaVM* vm, void* reserved) { 23 base::android::LibraryLoaderExitHook(); 24 } 25