OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ | 5 #ifndef BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ |
6 #define BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ | 6 #define BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 inline void HandleRegistrationError(JNIEnv* env, | 35 inline void HandleRegistrationError(JNIEnv* env, |
36 jclass clazz, | 36 jclass clazz, |
37 const char* filename) { | 37 const char* filename) { |
38 LOG(ERROR) << "RegisterNatives failed in " << filename; | 38 LOG(ERROR) << "RegisterNatives failed in " << filename; |
39 } | 39 } |
40 | 40 |
41 inline void CheckException(JNIEnv* env) { | 41 inline void CheckException(JNIEnv* env) { |
42 base::android::CheckException(env); | 42 base::android::CheckException(env); |
43 } | 43 } |
44 | 44 |
| 45 inline bool ShouldSkipJniRegistration(bool is_maindex_class) { |
| 46 switch (base::android::GetJniRegistrationType()) { |
| 47 case base::android::ALL_JNI_REGISTRATION: |
| 48 return false; |
| 49 case base::android::NO_JNI_REGISTRATION: |
| 50 // TODO(estevenson): Change this to a DCHECK. |
| 51 return true; |
| 52 case base::android::SELECTIVE_JNI_REGISTRATION: |
| 53 return !is_maindex_class; |
| 54 default: |
| 55 NOTREACHED(); |
| 56 return false; |
| 57 } |
| 58 } |
| 59 |
45 } // namespace jni_generator | 60 } // namespace jni_generator |
46 | 61 |
47 #endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ | 62 #endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ |
OLD | NEW |