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

Side by Side Diff: base/android/jni_generator/jni_generator_helper.h

Issue 2501193003: Selectively perform JNI registration in render processes on Android. (Closed)
Patch Set: Conditionally register JNI based on process type. Created 3 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 unified diff | Download patch
OLDNEW
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
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 base::android::JniRegistrationType jni_type =
47 base::android::FetchJniRegistrationType();
48 if (jni_type == base::android::NO_JNI_REGISTRATION) {
49 // TODO(estevenson): Change this to a DCHECK.
50 return true;
51 } else if (jni_type == base::android::ALL_JNI_REGISTRATION) {
52 return false;
53 } else if (jni_type == base::android::SELECTIVE_JNI_REGISTRATION) {
54 return !is_maindex_class;
55 } else {
56 NOTREACHED() << "g_jni_registration_type not set.";
57 return false;
58 }
59 }
60
45 } // namespace jni_generator 61 } // namespace jni_generator
46 62
47 #endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_ 63 #endif // BASE_ANDROID_JNI_GENERATOR_JNI_GENERATOR_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698