| // Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // This file is autogenerated by |
| // base/android/jni_generator/jni_generator.py |
| // For |
| // org/chromium/TestJni |
| |
| #ifndef org_chromium_TestJni_JNI |
| #define org_chromium_TestJni_JNI |
| |
| #include <jni.h> |
| |
| #include "base/android/jni_generator/jni_generator_helper.h" |
| |
| #include "base/android/jni_int_wrapper.h" |
| |
| // Step 1: forward declarations. |
| namespace { |
| const char kTestJniClassPath[] = "org/chromium/TestJni"; |
| // Leaking this jclass as we cannot use LazyInstance from some threads. |
| base::subtle::AtomicWord g_TestJni_clazz __attribute__((unused)) = 0; |
| #define TestJni_clazz(env) base::android::LazyGetClass(env, kTestJniClassPath, &g_TestJni_clazz) |
| |
| } // namespace |
| |
| // Step 2: method stubs. |
| extern "C" __attribute__((visibility("default"))) |
| void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env, |
| jobject jcaller, |
| jlong nativeChromeBrowserProvider) { |
| ChromeBrowserProvider* native = |
| reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); |
| CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); |
| return native->Destroy(env, base::android::JavaParamRef<jobject>(env, |
| jcaller)); |
| } |
| |
| // Step 3: RegisterNatives. |
| |
| static const JNINativeMethod kMethodsTestJni[] = { |
| { "nativeDestroy", |
| "(" |
| "J" |
| ")" |
| "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) }, |
| }; |
| |
| static bool RegisterNativesImpl(JNIEnv* env) { |
| if (base::android::IsManualJniRegistrationDisabled()) return true; |
| |
| const int kMethodsTestJniSize = arraysize(kMethodsTestJni); |
| |
| if (env->RegisterNatives(TestJni_clazz(env), |
| kMethodsTestJni, |
| kMethodsTestJniSize) < 0) { |
| jni_generator::HandleRegistrationError( |
| env, TestJni_clazz(env), __FILE__); |
| return false; |
| } |
| |
| return true; |
| } |
| |
| #endif // org_chromium_TestJni_JNI |