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

Unified Diff: base/android/base_jni_onload.cc

Issue 951673002: Revert "Pull chromium at 2c3ffb2355a27c32f45e508ef861416b820c823b" (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 | « base/android/base_jni_onload.h ('k') | base/android/java/src/org/chromium/base/ResourceExtractor.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/base_jni_onload.cc
diff --git a/base/android/base_jni_onload.cc b/base/android/base_jni_onload.cc
index c3a65d40cb1740eb5c784fb9441aa130cbdd7819..ae64120902741e28a83f13f4f7da2e52e946bdd5 100644
--- a/base/android/base_jni_onload.cc
+++ b/base/android/base_jni_onload.cc
@@ -5,51 +5,59 @@
#include "base/android/base_jni_onload.h"
#include "base/android/jni_android.h"
-#include "base/android/jni_utils.h"
+#include "base/android/jni_onload_delegate.h"
#include "base/android/library_loader/library_loader_hooks.h"
-#include "base/bind.h"
namespace base {
namespace android {
namespace {
-bool RegisterJNI(JNIEnv* env) {
+// The JNIOnLoadDelegate implementation in base.
+class BaseJNIOnLoadDelegate : public JNIOnLoadDelegate {
+ public:
+ bool RegisterJNI(JNIEnv* env) override;
+ bool Init() override;
+};
+
+bool BaseJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) {
return RegisterLibraryLoaderEntryHook(env);
}
-bool Init() {
- JNIEnv* env = base::android::AttachCurrentThread();
- base::android::InitReplacementClassLoader(env,
- base::android::GetClassLoader(env));
+bool BaseJNIOnLoadDelegate::Init() {
return true;
}
} // namespace
-bool OnJNIOnLoadRegisterJNI(JavaVM* vm,
- std::vector<RegisterCallback> callbacks) {
+bool OnJNIOnLoad(JavaVM* vm,
+ std::vector<JNIOnLoadDelegate*>* delegates) {
base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
- callbacks.push_back(base::Bind(&RegisterJNI));
- for (std::vector<RegisterCallback>::reverse_iterator i =
- callbacks.rbegin(); i != callbacks.rend(); ++i) {
- if (!i->Run(env))
- return false;
+ BaseJNIOnLoadDelegate delegate;
+ delegates->push_back(&delegate);
+ bool ret = true;
+ for (std::vector<JNIOnLoadDelegate*>::reverse_iterator i =
+ delegates->rbegin(); i != delegates->rend(); ++i) {
+ if (!(*i)->RegisterJNI(env)) {
+ ret = false;
+ break;
+ }
}
- return true;
-}
-bool OnJNIOnLoadInit(std::vector<InitCallback> callbacks) {
- callbacks.push_back(base::Bind(&Init));
- for (std::vector<InitCallback>::reverse_iterator i =
- callbacks.rbegin(); i != callbacks.rend(); ++i) {
- if (!i->Run())
- return false;
+ if (ret) {
+ for (std::vector<JNIOnLoadDelegate*>::reverse_iterator i =
+ delegates->rbegin(); i != delegates->rend(); ++i) {
+ if (!(*i)->Init()) {
+ ret = false;
+ break;
+ }
+ }
}
- return true;
+ delegates->pop_back();
+ return ret;
}
} // namespace android
« no previous file with comments | « base/android/base_jni_onload.h ('k') | base/android/java/src/org/chromium/base/ResourceExtractor.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698