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

Unified Diff: chromecast/app/android/cast_jni_loader.cc

Issue 935413004: Separate OnJNIOnLoad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync 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
« no previous file with comments | « chrome/app/android/chrome_jni_onload.cc ('k') | content/app/android/content_jni_onload.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/app/android/cast_jni_loader.cc
diff --git a/chromecast/app/android/cast_jni_loader.cc b/chromecast/app/android/cast_jni_loader.cc
index d2cc9c75edc4b87f52adfe540c831ddc107e74f0..98223f2c954e5a093d93ed1847757a218f4aee42 100644
--- a/chromecast/app/android/cast_jni_loader.cc
+++ b/chromecast/app/android/cast_jni_loader.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 "chromecast/android/cast_jni_registrar.h"
#include "chromecast/android/platform_jni_loader.h"
#include "chromecast/app/cast_main_delegate.h"
@@ -13,32 +13,31 @@
namespace {
-class CastJNIOnLoadDelegate : 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 (!chromecast::android::RegisterJni(env))
- return false;
- // Allow platform-specific implementations to perform more JNI registration.
- if (!chromecast::android::PlatformRegisterJni(env))
- return false;
- return true;
- }
+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 (!chromecast::android::RegisterJni(env))
+ return false;
+ // Allow platform-specific implementations to perform more JNI registration.
+ if (!chromecast::android::PlatformRegisterJni(env))
+ return false;
+ return true;
+}
- bool Init() override {
- content::Compositor::Initialize();
- content::SetContentMainDelegate(new chromecast::shell::CastMainDelegate);
- return true;
- }
-};
+bool Init() {
+ content::Compositor::Initialize();
+ content::SetContentMainDelegate(new chromecast::shell::CastMainDelegate);
+ 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) {
- CastJNIOnLoadDelegate 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;
}
« no previous file with comments | « chrome/app/android/chrome_jni_onload.cc ('k') | content/app/android/content_jni_onload.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698