| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/browser/android_library_loader_hooks.h" | 5 #include "content/public/browser/android_library_loader_hooks.h" |
| 6 | 6 |
| 7 #include "base/android/base_jni_registrar.h" | 7 #include "base/android/base_jni_registrar.h" |
| 8 #include "base/android/jni_registrar.h" | 8 #include "base/android/jni_registrar.h" |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 if (!content::android::RegisterJni(env)) | 66 if (!content::android::RegisterJni(env)) |
| 67 return JNI_FALSE; | 67 return JNI_FALSE; |
| 68 | 68 |
| 69 if (!media::RegisterJni(env)) | 69 if (!media::RegisterJni(env)) |
| 70 return JNI_FALSE; | 70 return JNI_FALSE; |
| 71 | 71 |
| 72 return JNI_TRUE; | 72 return JNI_TRUE; |
| 73 } | 73 } |
| 74 | 74 |
| 75 namespace content { |
| 76 |
| 75 void LibraryLoaderExitHook() { | 77 void LibraryLoaderExitHook() { |
| 76 if (g_at_exit_manager) { | 78 if (g_at_exit_manager) { |
| 77 delete g_at_exit_manager; | 79 delete g_at_exit_manager; |
| 78 g_at_exit_manager = NULL; | 80 g_at_exit_manager = NULL; |
| 79 } | 81 } |
| 80 } | 82 } |
| 81 | 83 |
| 82 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { | 84 bool RegisterLibraryLoaderEntryHook(JNIEnv* env) { |
| 83 // TODO(bulach): use the jni generator once we move jni_helper methods here. | 85 // TODO(bulach): use the jni generator once we move jni_helper methods here. |
| 84 const JNINativeMethod kMethods[] = { | 86 const JNINativeMethod kMethods[] = { |
| 85 { "nativeLibraryLoadedOnMainThread", "([Ljava/lang/String;)Z", | 87 { "nativeLibraryLoadedOnMainThread", "([Ljava/lang/String;)Z", |
| 86 reinterpret_cast<void*>(LibraryLoaderEntryHook) }, | 88 reinterpret_cast<void*>(LibraryLoaderEntryHook) }, |
| 87 }; | 89 }; |
| 88 const int kMethodsSize = arraysize(kMethods); | 90 const int kMethodsSize = arraysize(kMethods); |
| 89 const char kLibraryLoaderPath[] = | 91 const char kLibraryLoaderPath[] = |
| 90 "org/chromium/content/browser/LibraryLoader"; | 92 "org/chromium/content/browser/LibraryLoader"; |
| 91 base::android::ScopedJavaLocalRef<jclass> clazz = | 93 base::android::ScopedJavaLocalRef<jclass> clazz = |
| 92 base::android::GetClass(env, kLibraryLoaderPath); | 94 base::android::GetClass(env, kLibraryLoaderPath); |
| 93 | 95 |
| 94 if (env->RegisterNatives(clazz.obj(), | 96 if (env->RegisterNatives(clazz.obj(), |
| 95 kMethods, | 97 kMethods, |
| 96 kMethodsSize) < 0) { | 98 kMethodsSize) < 0) { |
| 97 return false; | 99 return false; |
| 98 } | 100 } |
| 99 return true; | 101 return true; |
| 100 } | 102 } |
| 103 |
| 104 } // namespace content |
| OLD | NEW |