Index: base/android/jni_generator/jni_generator_helper.h |
diff --git a/base/android/jni_generator/jni_generator_helper.h b/base/android/jni_generator/jni_generator_helper.h |
index 4c159c03a9f3975b08b487821a1839185918017b..e5b8ac036bb4cc5fb18586c117281bf8ba5be1fb 100644 |
--- a/base/android/jni_generator/jni_generator_helper.h |
+++ b/base/android/jni_generator/jni_generator_helper.h |
@@ -8,6 +8,7 @@ |
#include <jni.h> |
#include "base/android/jni_android.h" |
+#include "base/android/library_loader/library_loader_hooks.h" |
#include "base/android/scoped_java_ref.h" |
#include "base/logging.h" |
#include "build/build_config.h" |
@@ -42,6 +43,22 @@ inline void CheckException(JNIEnv* env) { |
base::android::CheckException(env); |
} |
+inline bool ShouldSkipJniRegistration(bool is_maindex_class) { |
+ base::android::JniRegistrationType jni_type = |
+ base::android::GetJniRegistrationType(); |
+ if (jni_type == base::android::NO_JNI_REGISTRATION) { |
+ // TODO(estevenson): Change this to a DCHECK. |
+ return true; |
+ } else if (jni_type == base::android::ALL_JNI_REGISTRATION) { |
+ return false; |
+ } else if (jni_type == base::android::SELECTIVE_JNI_REGISTRATION) { |
+ return !is_maindex_class; |
+ } else { |
+ // The registration type isn't always initialized in tests by this point. |
estevenson
2017/01/09 13:20:00
Not sure about this. In instrumentation tests the
Torne
2017/01/09 16:43:32
I don't think it's okay that we ever see PROCESS_U
estevenson
2017/01/12 03:46:49
Added init code everywhere necessary for tests.
|
+ return false; |
+ } |
+} |
+ |
} // namespace jni_generator |
#endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ |