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

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

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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
(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/Foo
9
10 #ifndef org_chromium_foo_Foo_JNI
11 #define org_chromium_foo_Foo_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
19 // Step 1: forward declarations.
20 namespace {
21 const char kFooClassPath[] = "org/chromium/foo/Foo";
22 // Leaking this jclass as we cannot use LazyInstance from some threads.
23 jclass g_Foo_clazz = NULL;
24 #define Foo_clazz(env) g_Foo_clazz
25
26 } // namespace
27
28 static void DoSomething(JNIEnv* env, jclass jcaller,
29 jobject callback1,
30 jobject callback2);
31
32 // Step 2: method stubs.
33
34 static base::subtle::AtomicWord g_Foo_calledByNative = 0;
35 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback1,
36 jobject callback2) {
37 /* Must call RegisterNativesImpl() */
38 CHECK_CLAZZ(env, Foo_clazz(env),
39 Foo_clazz(env));
40 jmethodID method_id =
41 base::android::MethodID::LazyGet<
42 base::android::MethodID::TYPE_STATIC>(
43 env, Foo_clazz(env),
44 "calledByNative",
45
46 "("
47 "Lorg/chromium/foo/Bar1$Callback;"
48 "Lorg/chromium/foo/Bar2$Callback;"
49 ")"
50 "V",
51 &g_Foo_calledByNative);
52
53 env->CallStaticVoidMethod(Foo_clazz(env),
54 method_id, callback1, callback2);
55 jni_generator::CheckException(env);
56
57 }
58
59 // Step 3: RegisterNatives.
60
61 static const JNINativeMethod kMethodsFoo[] = {
62 { "nativeDoSomething",
63 "("
64 "Lorg/chromium/foo/Bar1$Callback;"
65 "Lorg/chromium/foo/Bar2$Callback;"
66 ")"
67 "V", reinterpret_cast<void*>(DoSomething) },
68 };
69
70 static bool RegisterNativesImpl(JNIEnv* env) {
71
72 g_Foo_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
73 base::android::GetClass(env, kFooClassPath).obj()));
74
75 const int kMethodsFooSize = arraysize(kMethodsFoo);
76
77 if (env->RegisterNatives(Foo_clazz(env),
78 kMethodsFoo,
79 kMethodsFooSize) < 0) {
80 jni_generator::HandleRegistrationError(
81 env, Foo_clazz(env), __FILE__);
82 return false;
83 }
84
85 return true;
86 }
87
88 #endif // org_chromium_foo_Foo_JNI
OLDNEW
« no previous file with comments | « base/android/jni_generator/testMotionEvent.javap7 ('k') | base/android/jni_generator/testNativeExportsOption.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698