[SyncFS] Build indexes from FileTracker entries on disk.
[chromium-blink-merge.git] / base / android / jni_generator / testSingleJNIAdditionalImport.golden
blobe395657cf79bfc5b48642d54426b2d83a72c33c3
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
3 // found in the LICENSE file.
5 // This file is autogenerated by
6 //     base/android/jni_generator/jni_generator.py
7 // For
8 //     org/chromium/foo/Foo
10 #ifndef org_chromium_foo_Foo_JNI
11 #define org_chromium_foo_Foo_JNI
13 #include <jni.h>
15 #include "base/android/jni_generator/jni_generator_helper.h"
17 #include "base/android/jni_int_wrapper.h"
19 // Step 1: forward declarations.
20 namespace {
21 const char kFooClassPath[] = "org/chromium/foo/Foo";
22 // Leaking this jclass as we cannot use LazyInstance from some threads.
23 jclass g_Foo_clazz = NULL;
25 }  // namespace
27 static void DoSomething(JNIEnv* env, jclass jcaller,
28     jobject callback);
30 // Step 2: method stubs.
32 static base::subtle::AtomicWord g_Foo_calledByNative = 0;
33 static void Java_Foo_calledByNative(JNIEnv* env, jobject callback) {
34   /* Must call RegisterNativesImpl()  */
35   CHECK_CLAZZ(env, g_Foo_clazz,
36       g_Foo_clazz);
37   jmethodID method_id =
38       base::android::MethodID::LazyGet<
39       base::android::MethodID::TYPE_STATIC>(
40       env, g_Foo_clazz,
41       "calledByNative",
43 "("
44 "Lorg/chromium/foo/Bar$Callback;"
45 ")"
46 "V",
47       &g_Foo_calledByNative);
49      env->CallStaticVoidMethod(g_Foo_clazz,
50           method_id, callback);
51   jni_generator::CheckException(env);
55 // Step 3: RegisterNatives.
57 static const JNINativeMethod kMethodsFoo[] = {
58     { "nativeDoSomething",
59 "("
60 "Lorg/chromium/foo/Bar$Callback;"
61 ")"
62 "V", reinterpret_cast<void*>(DoSomething) },
65 static bool RegisterNativesImpl(JNIEnv* env) {
66   g_Foo_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
67       base::android::GetClass(env, kFooClassPath).obj()));
69   const int kMethodsFooSize = arraysize(kMethodsFoo);
71   if (env->RegisterNatives(g_Foo_clazz,
72                            kMethodsFoo,
73                            kMethodsFooSize) < 0) {
74     jni_generator::HandleRegistrationError(
75         env, g_Foo_clazz, __FILE__);
76     return false;
77   }
79   return true;
82 #endif  // org_chromium_foo_Foo_JNI