| 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 // java/util/HashSet | |
| 9 | |
| 10 #ifndef java_util_HashSet_JNI | |
| 11 #define java_util_HashSet_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 kHashSetClassPath[] = "java/util/HashSet"; | |
| 25 // Leaking this jclass as we cannot use LazyInstance from some threads. | |
| 26 jclass g_HashSet_clazz = NULL; | |
| 27 } // namespace | |
| 28 | |
| 29 namespace JNI_HashSet { | |
| 30 | |
| 31 // Step 2: method stubs. | |
| 32 | |
| 33 static base::subtle::AtomicWord g_HashSet_dummy = 0; | |
| 34 static void Java_HashSet_dummy(JNIEnv* env, jobject obj) __attribute__ | |
| 35 ((unused)); | |
| 36 static void Java_HashSet_dummy(JNIEnv* env, jobject obj) { | |
| 37 /* Must call RegisterNativesImpl() */ | |
| 38 DCHECK(g_HashSet_clazz); | |
| 39 jmethodID method_id = | |
| 40 base::android::MethodID::LazyGet< | |
| 41 base::android::MethodID::TYPE_INSTANCE>( | |
| 42 env, g_HashSet_clazz, | |
| 43 "dummy", | |
| 44 "()V", | |
| 45 &g_HashSet_dummy); | |
| 46 | |
| 47 env->CallVoidMethod(obj, | |
| 48 method_id); | |
| 49 base::android::CheckException(env); | |
| 50 | |
| 51 } | |
| 52 | |
| 53 // Step 3: RegisterNatives. | |
| 54 | |
| 55 static bool RegisterNativesImpl(JNIEnv* env) { | |
| 56 | |
| 57 g_HashSet_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | |
| 58 base::android::GetClass(env, kHashSetClassPath).obj())); | |
| 59 return true; | |
| 60 } | |
| 61 } // namespace JNI_HashSet | |
| 62 | |
| 63 #endif // java_util_HashSet_JNI | |
| OLD | NEW |