Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1461)

Unified Diff: content/shell/android/linker_test_apk/chromium_linker_test_android.cc

Issue 935413004: Separate OnJNIOnLoad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix chromecast Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6e8ef567e98c644416f235d22613e8c800c91688..b8aa1fab5ab7d34cffa51a4e1f02d3fc4b32e75d 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,7 +3,7 @@
// found in the LICENSE file.
#include "base/android/jni_android.h"
-#include "base/android/jni_onload_delegate.h"
+#include "base/bind.h"
#include "content/public/app/content_jni_onload.h"
#include "content/public/app/content_main.h"
#include "content/public/browser/android/compositor.h"
@@ -13,34 +13,31 @@
namespace {
-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;
+bool RegisterJNI(JNIEnv* env) {
+ // 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;
- if (!content::RegisterLinkerTestsJni(env))
- return false;
+ if (!content::RegisterLinkerTestsJni(env))
+ return false;
- return true;
- }
+ return true;
+}
- bool Init() override {
- content::Compositor::Initialize();
- content::SetContentMainDelegate(new content::ShellMainDelegate());
- return true;
- }
-};
+bool Init() {
+ content::Compositor::Initialize();
+ content::SetContentMainDelegate(new content::ShellMainDelegate());
+ return true;
+}
} // 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))
+ if (!content::android::OnJNIOnLoadRegisterJNI(
+ vm, base::Bind(&RegisterJNI)) ||
+ !content::android::OnJNIOnLoadInit(base::Bind(&Init)))
return -1;
return JNI_VERSION_1_4;

Powered by Google App Engine
This is Rietveld 408576698