OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 // java/util/HashSet | 8 // java/util/HashSet |
9 | 9 |
10 #ifndef java_util_HashSet_JNI | 10 #ifndef java_util_HashSet_JNI |
11 #define java_util_HashSet_JNI | 11 #define java_util_HashSet_JNI |
12 | 12 |
13 #include <jni.h> | 13 #include <jni.h> |
14 | 14 |
15 #include "base/android/jni_android.h" | 15 #include "base/android/jni_generator/jni_generator_helper.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 | 16 |
22 // Step 1: forward declarations. | 17 // Step 1: forward declarations. |
23 namespace { | 18 namespace { |
24 const char kHashSetClassPath[] = "java/util/HashSet"; | 19 const char kHashSetClassPath[] = "java/util/HashSet"; |
25 // Leaking this jclass as we cannot use LazyInstance from some threads. | 20 // Leaking this jclass as we cannot use LazyInstance from some threads. |
26 jclass g_HashSet_clazz = NULL; | 21 jclass g_HashSet_clazz = NULL; |
| 22 |
27 } // namespace | 23 } // namespace |
28 | 24 |
29 namespace JNI_HashSet { | 25 namespace JNI_HashSet { |
30 | 26 |
31 // Step 2: method stubs. | 27 // Step 2: method stubs. |
32 | 28 |
33 static base::subtle::AtomicWord g_HashSet_dummy = 0; | 29 static base::subtle::AtomicWord g_HashSet_dummy = 0; |
34 static void Java_HashSet_dummy(JNIEnv* env, jobject obj) __attribute__ | 30 static void Java_HashSet_dummy(JNIEnv* env, jobject obj) __attribute__ |
35 ((unused)); | 31 ((unused)); |
36 static void Java_HashSet_dummy(JNIEnv* env, jobject obj) { | 32 static void Java_HashSet_dummy(JNIEnv* env, jobject obj) { |
37 /* Must call RegisterNativesImpl() */ | 33 /* Must call RegisterNativesImpl() */ |
38 DCHECK(g_HashSet_clazz); | 34 DCHECK_CLAZZ(g_HashSet_clazz); |
39 jmethodID method_id = | 35 jmethodID method_id = |
40 base::android::MethodID::LazyGet< | 36 base::android::MethodID::LazyGet< |
41 base::android::MethodID::TYPE_INSTANCE>( | 37 base::android::MethodID::TYPE_INSTANCE>( |
42 env, g_HashSet_clazz, | 38 env, g_HashSet_clazz, |
43 "dummy", | 39 "dummy", |
44 "()V", | 40 "()V", |
45 &g_HashSet_dummy); | 41 &g_HashSet_dummy); |
46 | 42 |
47 env->CallVoidMethod(obj, | 43 env->CallVoidMethod(obj, |
48 method_id); | 44 method_id); |
49 base::android::CheckException(env); | 45 jni_generator::CheckException(env); |
50 | 46 |
51 } | 47 } |
52 | 48 |
53 // Step 3: RegisterNatives. | 49 // Step 3: RegisterNatives. |
54 | 50 |
55 static bool RegisterNativesImpl(JNIEnv* env) { | 51 static bool RegisterNativesImpl(JNIEnv* env) { |
56 | |
57 g_HashSet_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 52 g_HashSet_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
58 base::android::GetClass(env, kHashSetClassPath).obj())); | 53 base::android::GetClass(env, kHashSetClassPath).obj())); |
| 54 |
59 return true; | 55 return true; |
60 } | 56 } |
| 57 |
61 } // namespace JNI_HashSet | 58 } // namespace JNI_HashSet |
62 | 59 |
63 #endif // java_util_HashSet_JNI | 60 #endif // java_util_HashSet_JNI |
OLD | NEW |