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

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

Issue 290403002: Adding JNIAdditionalImport annotation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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
25 } // namespace
26
27 // Step 2: method stubs.
28
29 static base::subtle::AtomicWord g_Foo_calledByNative = 0;
30 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback) {
31 /* Must call RegisterNativesImpl() */
32 CHECK_CLAZZ(env, g_Foo_clazz,
33 g_Foo_clazz);
34 jmethodID method_id =
35 base::android::MethodID::LazyGet<
36 base::android::MethodID::TYPE_STATIC>(
37 env, g_Foo_clazz,
38 "calledByNative",
39
40 "("
41 "Lorg/chromium/foo/Bar$Callback;"
42 ")"
43 "V",
44 &g_Foo_calledByNative);
45
46 env->CallStaticVoidMethod(g_Foo_clazz,
47 method_id, callback);
48 jni_generator::CheckException(env);
49
50 }
51
52 // Step 3: RegisterNatives.
53
54 static bool RegisterNativesImpl(JNIEnv* env) {
55 g_Foo_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
56 base::android::GetClass(env, kFooClassPath).obj()));
57
58 return true;
59 }
60
61 #endif // org_chromium_foo_Foo_JNI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698