// Copyright 2013 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 #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h" #include "base/basictypes.h" #include "base/logging.h" using base::android::ScopedJavaLocalRef; // Step 1: forward declarations. namespace { const char kMyOtherInnerClassClassPath[] = "org/chromium/TestJni$MyOtherInnerClass"; const char kTestJniClassPath[] = "org/chromium/TestJni"; const char kMyInnerClassClassPath[] = "org/chromium/TestJni$MyInnerClass"; // Leaking this jclass as we cannot use LazyInstance from some threads. jclass g_TestJni_clazz = NULL; } // namespace static jint Init(JNIEnv* env, jobject obj); static jint Init(JNIEnv* env, jobject obj); // Step 2: method stubs. // Step 3: RegisterNatives. static bool RegisterNativesImpl(JNIEnv* env) { g_TestJni_clazz = reinterpret_cast(env->NewGlobalRef( base::android::GetClass(env, kTestJniClassPath).obj())); static const JNINativeMethod kMethodsMyOtherInnerClass[] = { { "nativeInit", "(" ")" "I", reinterpret_cast(Init) }, }; const int kMethodsMyOtherInnerClassSize = arraysize(kMethodsMyOtherInnerClass); if (env->RegisterNatives(g_MyOtherInnerClass_clazz, kMethodsMyOtherInnerClass, kMethodsMyOtherInnerClassSize) < 0) { LOG(ERROR) << "RegisterNatives failed in " << __FILE__; return false; } static const JNINativeMethod kMethodsMyInnerClass[] = { { "nativeInit", "(" ")" "I", reinterpret_cast(Init) }, }; const int kMethodsMyInnerClassSize = arraysize(kMethodsMyInnerClass); if (env->RegisterNatives(g_MyInnerClass_clazz, kMethodsMyInnerClass, kMethodsMyInnerClassSize) < 0) { LOG(ERROR) << "RegisterNatives failed in " << __FILE__; return false; } return true; } #endif // org_chromium_TestJni_JNI