OLD | NEW |
| (Empty) |
1 // Copyright 2013 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/example/jni_generator/Example | |
9 | |
10 #ifndef org_chromium_example_jni_generator_Example_JNI | |
11 #define org_chromium_example_jni_generator_Example_JNI | |
12 | |
13 #include <jni.h> | |
14 | |
15 #include "base/android/jni_android.h" | |
16 #include "base/android/scoped_java_ref.h" | |
17 #include "base/basictypes.h" | |
18 #include "base/logging.h" | |
19 | |
20 using base::android::ScopedJavaLocalRef; | |
21 | |
22 // Step 1: forward declarations. | |
23 namespace { | |
24 const char kExampleClassPath[] = "com/test/jni_generator/Example"; | |
25 // Leaking this jclass as we cannot use LazyInstance from some threads. | |
26 jclass g_Example_clazz = NULL; | |
27 } // namespace | |
28 | |
29 static void Test(JNIEnv* env, jclass clazz, | |
30 jobject t); | |
31 | |
32 // Step 2: method stubs. | |
33 | |
34 // Step 3: RegisterNatives. | |
35 | |
36 static bool RegisterNativesImpl(JNIEnv* env) { | |
37 | |
38 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | |
39 base::android::GetClass(env, kExampleClassPath).obj())); | |
40 static const JNINativeMethod kMethodsExample[] = { | |
41 { "nativeTest", | |
42 "(" | |
43 "Lorg/test2/org/chromium/example2/Test;" | |
44 ")" | |
45 "V", reinterpret_cast<void*>(Test) }, | |
46 }; | |
47 const int kMethodsExampleSize = arraysize(kMethodsExample); | |
48 | |
49 if (env->RegisterNatives(g_Example_clazz, | |
50 kMethodsExample, | |
51 kMethodsExampleSize) < 0) { | |
52 LOG(ERROR) << "RegisterNatives failed in " << __FILE__; | |
53 return false; | |
54 } | |
55 | |
56 return true; | |
57 } | |
58 | |
59 #endif // org_chromium_example_jni_generator_Example_JNI | |
OLD | NEW |