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

Side by Side Diff: base/android/jni_generator/testNonMainDexFile.golden

Issue 2501193003: Selectively perform JNI registration in render processes on Android. (Closed)
Patch Set: Add @MainDex where it's missing Created 4 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // This file is autogenerated by
6 // base/android/jni_generator/jni_generator.py
7 // For
8 // org/chromium/foo/Bar
9
10 #ifndef org_chromium_foo_Bar_JNI
11 #define org_chromium_foo_Bar_JNI
12
13 #include <jni.h>
14
15 #include "base/android/jni_generator/jni_generator_helper.h"
16
17 #include "base/android/jni_int_wrapper.h"
18 #include "base/android/jni_utils.h"
19
20 // Step 1: forward declarations.
21 namespace {
22 const char kBarClassPath[] = "org/chromium/foo/Bar";
23 // Leaking this jclass as we cannot use LazyInstance from some threads.
24 base::subtle::AtomicWord g_Bar_clazz __attribute__((unused)) = 0;
25 #define Bar_clazz(env) base::android::LazyGetClass(env, kBarClassPath, &g_Bar_cl azz)
26
27 } // namespace
28
29 // Step 2: method stubs.
30 JNI_GENERATOR_EXPORT jint Java_org_chromium_foo_Bar_nativeStaticMethod(JNIEnv*
31 env, jobject jcaller,
32 jlong nativeTest,
33 jint arg1) {
34 Test* native = reinterpret_cast<Test*>(nativeTest);
35 CHECK_NATIVE_PTR(env, jcaller, native, "StaticMethod", 0);
36 return native->StaticMethod(env, base::android::JavaParamRef<jobject>(env,
37 jcaller), arg1);
38 }
39
40 // Step 3: RegisterNatives.
41
42 static const JNINativeMethod kMethodsBar[] = {
43 { "nativeStaticMethod",
44 "("
45 "J"
46 "I"
47 ")"
48 "I", reinterpret_cast<void*>(Java_org_chromium_foo_Bar_nativeStaticMethod) },
49 };
50
51 static bool RegisterNativesImpl(JNIEnv* env) {
52 if (base::android::IsManualJniRegistrationDisabled()) return true;
53 if (base::android::IsMultidexEnabled(env) &&
54 base::android::GetLibraryProcessType(env) !=
55 base::android::PROCESS_BROWSER) {
56 return true;
57 }
58
59 const int kMethodsBarSize = arraysize(kMethodsBar);
60
61 if (env->RegisterNatives(Bar_clazz(env),
62 kMethodsBar,
63 kMethodsBarSize) < 0) {
64 jni_generator::HandleRegistrationError(
65 env, Bar_clazz(env), __FILE__);
66 return false;
67 }
68
69 return true;
70 }
71
72 #endif // org_chromium_foo_Bar_JNI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698