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/TestJni | |
9 | |
10 #ifndef org_chromium_TestJni_JNI | |
11 #define org_chromium_TestJni_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 kMyOtherInnerClassClassPath[] = | |
25 "org/chromium/TestJni$MyOtherInnerClass"; | |
26 const char kTestJniClassPath[] = "org/chromium/TestJni"; | |
27 // Leaking this jclass as we cannot use LazyInstance from some threads. | |
28 jclass g_TestJni_clazz = NULL; | |
29 } // namespace | |
30 | |
31 static jint Init(JNIEnv* env, jobject obj); | |
32 | |
33 static jint Init(JNIEnv* env, jobject obj); | |
34 | |
35 // Step 2: method stubs. | |
36 | |
37 // Step 3: RegisterNatives. | |
38 | |
39 static bool RegisterNativesImpl(JNIEnv* env) { | |
40 | |
41 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | |
42 base::android::GetClass(env, kTestJniClassPath).obj())); | |
43 static const JNINativeMethod kMethodsMyOtherInnerClass[] = { | |
44 { "nativeInit", | |
45 "(" | |
46 ")" | |
47 "I", reinterpret_cast<void*>(Init) }, | |
48 }; | |
49 const int kMethodsMyOtherInnerClassSize = | |
50 arraysize(kMethodsMyOtherInnerClass); | |
51 | |
52 if (env->RegisterNatives(g_MyOtherInnerClass_clazz, | |
53 kMethodsMyOtherInnerClass, | |
54 kMethodsMyOtherInnerClassSize) < 0) { | |
55 LOG(ERROR) << "RegisterNatives failed in " << __FILE__; | |
56 return false; | |
57 } | |
58 | |
59 static const JNINativeMethod kMethodsTestJni[] = { | |
60 { "nativeInit", | |
61 "(" | |
62 ")" | |
63 "I", reinterpret_cast<void*>(Init) }, | |
64 }; | |
65 const int kMethodsTestJniSize = arraysize(kMethodsTestJni); | |
66 | |
67 if (env->RegisterNatives(g_TestJni_clazz, | |
68 kMethodsTestJni, | |
69 kMethodsTestJniSize) < 0) { | |
70 LOG(ERROR) << "RegisterNatives failed in " << __FILE__; | |
71 return false; | |
72 } | |
73 | |
74 return true; | |
75 } | |
76 | |
77 #endif // org_chromium_TestJni_JNI | |
OLD | NEW |