Index: content/shell/android/linker_test_apk/chromium_linker_test_android.cc |
diff --git a/content/shell/android/linker_test_apk/chromium_linker_test_android.cc b/content/shell/android/linker_test_apk/chromium_linker_test_android.cc |
index 5173128dc8a8ff5f81316a48a87ef0e56716e99e..6e8ef567e98c644416f235d22613e8c800c91688 100644 |
--- a/content/shell/android/linker_test_apk/chromium_linker_test_android.cc |
+++ b/content/shell/android/linker_test_apk/chromium_linker_test_android.cc |
@@ -3,38 +3,45 @@ |
// found in the LICENSE file. |
#include "base/android/jni_android.h" |
-#include "base/android/jni_registrar.h" |
-#include "base/android/library_loader/library_loader_hooks.h" |
-#include "base/basictypes.h" |
-#include "base/debug/debugger.h" |
-#include "base/logging.h" |
-#include "content/public/app/android_library_loader_hooks.h" |
+#include "base/android/jni_onload_delegate.h" |
+#include "content/public/app/content_jni_onload.h" |
#include "content/public/app/content_main.h" |
#include "content/public/browser/android/compositor.h" |
#include "content/shell/android/linker_test_apk/chromium_linker_test_linker_tests.h" |
#include "content/shell/android/shell_jni_registrar.h" |
#include "content/shell/app/shell_main_delegate.h" |
-// This is called by the VM when the shared library is first loaded. |
-JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
+namespace { |
- base::android::SetLibraryLoadedHook(&content::LibraryLoaded); |
+class ChromiumLinkerTestJNIOnLoadDelegate : |
+ public base::android::JNIOnLoadDelegate { |
+ public: |
+ bool RegisterJNI(JNIEnv* env) override { |
+ // To be called only from the UI thread. If loading the library is done on |
+ // a separate thread, this should be moved elsewhere. |
+ if (!content::android::RegisterShellJni(env)) |
+ return false; |
- base::android::InitVM(vm); |
- JNIEnv* env = base::android::AttachCurrentThread(); |
+ if (!content::RegisterLinkerTestsJni(env)) |
+ return false; |
- if (!base::android::RegisterLibraryLoaderEntryHook(env)) |
- return -1; |
+ return true; |
+ } |
- // To be called only from the UI thread. If loading the library is done on |
- // a separate thread, this should be moved elsewhere. |
- if (!content::android::RegisterShellJni(env)) |
- return -1; |
+ bool Init() override { |
+ content::Compositor::Initialize(); |
+ content::SetContentMainDelegate(new content::ShellMainDelegate()); |
+ return true; |
+ } |
+}; |
- if (!content::RegisterLinkerTestsJni(env)) |
+} // namespace |
+ |
+// This is called by the VM when the shared library is first loaded. |
+JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
+ ChromiumLinkerTestJNIOnLoadDelegate delegate; |
+ if (!content::android::OnJNIOnLoad(vm, &delegate)) |
return -1; |
- content::Compositor::Initialize(); |
- content::SetContentMainDelegate(new content::ShellMainDelegate()); |
return JNI_VERSION_1_4; |
} |