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

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

Issue 1312153003: jni_generator: Pass object parameters as JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 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 // This file is autogenerated by 5 // This file is autogenerated by
6 // base/android/jni_generator/jni_generator.py 6 // base/android/jni_generator/jni_generator.py
7 // For 7 // For
8 // org/chromium/foo/Foo 8 // org/chromium/foo/Foo
9 9
10 #ifndef org_chromium_foo_Foo_JNI 10 #ifndef org_chromium_foo_Foo_JNI
11 #define org_chromium_foo_Foo_JNI 11 #define org_chromium_foo_Foo_JNI
12 12
13 #include <jni.h> 13 #include <jni.h>
14 14
15 #include "base/android/jni_generator/jni_generator_helper.h" 15 #include "base/android/jni_generator/jni_generator_helper.h"
16 16
17 #include "base/android/jni_int_wrapper.h" 17 #include "base/android/jni_int_wrapper.h"
18 18
19 // Step 1: forward declarations. 19 // Step 1: forward declarations.
20 namespace { 20 namespace {
21 const char kFooClassPath[] = "org/chromium/foo/Foo"; 21 const char kFooClassPath[] = "org/chromium/foo/Foo";
22 // Leaking this jclass as we cannot use LazyInstance from some threads. 22 // Leaking this jclass as we cannot use LazyInstance from some threads.
23 jclass g_Foo_clazz = NULL; 23 jclass g_Foo_clazz = NULL;
24 #define Foo_clazz(env) g_Foo_clazz 24 #define Foo_clazz(env) g_Foo_clazz
25 25
26 } // namespace 26 } // namespace
27 27
28 // Step 2: method stubs. 28 // Step 2: method stubs.
29 29
30 static void DoSomething(JNIEnv* env, jclass jcaller, 30 static void DoSomething(JNIEnv* env, const JavaParamRef<jclass>& jcaller,
31 jobject callback1, 31 const JavaParamRef<jobject>& callback1,
32 jobject callback2); 32 const JavaParamRef<jobject>& callback2);
33 33
34 static void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv* env, jclass 34 static void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv* env, jclass
35 jcaller, 35 jcaller,
36 jobject callback1, 36 jobject callback1,
37 jobject callback2) { 37 jobject callback2) {
38 return DoSomething(env, jcaller, callback1, callback2); 38 return DoSomething(env, JavaParamRef<jclass>(env, jcaller),
39 JavaParamRef<jobject>(env, callback1), JavaParamRef<jobject>(env,
40 callback2));
39 } 41 }
40 42
41 static base::subtle::AtomicWord g_Foo_calledByNative = 0; 43 static base::subtle::AtomicWord g_Foo_calledByNative = 0;
42 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback1, 44 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback1,
43 jobject callback2) { 45 jobject callback2) {
44 /* Must call RegisterNativesImpl() */ 46 /* Must call RegisterNativesImpl() */
45 CHECK_CLAZZ(env, Foo_clazz(env), 47 CHECK_CLAZZ(env, Foo_clazz(env),
46 Foo_clazz(env)); 48 Foo_clazz(env));
47 jmethodID method_id = 49 jmethodID method_id =
48 base::android::MethodID::LazyGet< 50 base::android::MethodID::LazyGet<
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 kMethodsFooSize) < 0) { 88 kMethodsFooSize) < 0) {
87 jni_generator::HandleRegistrationError( 89 jni_generator::HandleRegistrationError(
88 env, Foo_clazz(env), __FILE__); 90 env, Foo_clazz(env), __FILE__);
89 return false; 91 return false;
90 } 92 }
91 93
92 return true; 94 return true;
93 } 95 }
94 96
95 #endif // org_chromium_foo_Foo_JNI 97 #endif // org_chromium_foo_Foo_JNI
OLDNEW
« no previous file with comments | « base/android/jni_generator/testJarJarRemapping.golden ('k') | base/android/jni_generator/testNativeExportsOption.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698