• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2014 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5
6// This file is autogenerated by
7//     third_party/jni_zero/jni_generator.py
8// For
9//     org/jni_zero/samples/SampleUniqueAnnotations
10
11#ifndef org_jni_zero_samples_SampleUniqueAnnotations_JNI
12#define org_jni_zero_samples_SampleUniqueAnnotations_JNI
13
14#include <jni.h>
15
16#include "third_party/jni_zero/jni_export.h"
17#include "third_party/jni_zero/jni_zero_helper.h"
18
19
20// Step 1: Forward declarations.
21
22JNI_ZERO_COMPONENT_BUILD_EXPORT extern const char
23    kClassPath_org_jni_1zero_samples_SampleUniqueAnnotations[];
24const char kClassPath_org_jni_1zero_samples_SampleUniqueAnnotations[] =
25    "org/jni_zero/samples/SampleUniqueAnnotations";
26// Leaking this jclass as we cannot use LazyInstance from some threads.
27JNI_ZERO_COMPONENT_BUILD_EXPORT std::atomic<jclass>
28    g_org_jni_1zero_samples_SampleUniqueAnnotations_clazz(nullptr);
29#ifndef org_jni_1zero_samples_SampleUniqueAnnotations_clazz_defined
30#define org_jni_1zero_samples_SampleUniqueAnnotations_clazz_defined
31inline jclass org_jni_1zero_samples_SampleUniqueAnnotations_clazz(JNIEnv* env) {
32  return base::android::LazyGetClass(env, kClassPath_org_jni_1zero_samples_SampleUniqueAnnotations,
33      &g_org_jni_1zero_samples_SampleUniqueAnnotations_clazz);
34}
35#endif
36
37
38// Step 2: Constants (optional).
39
40
41// Step 3: Method stubs.
42static jint JNI_SampleUniqueAnnotations_Bar(JNIEnv* env, jint x,
43    jint y);
44
45JNI_BOUNDARY_EXPORT jint
46    Java_org_jni_1zero_GEN_1JNI_org_1jni_11zero_1samples_1SampleUniqueAnnotations_1bar(
47    JNIEnv* env,
48    jclass jcaller,
49    jint x,
50    jint y) {
51  return JNI_SampleUniqueAnnotations_Bar(env, x, y);
52}
53
54JNI_BOUNDARY_EXPORT void
55    Java_org_jni_1zero_GEN_1JNI_org_1jni_11zero_1samples_1SampleUniqueAnnotations_1foo(
56    JNIEnv* env,
57    jclass jcaller,
58    jlong nativePtr) {
59  FooAndroid::BarDelegate* native = reinterpret_cast<FooAndroid::BarDelegate*>(nativePtr);
60  CHECK_NATIVE_PTR(env, jcaller, native, "Foo");
61  return native->Foo(env);
62}
63
64JNI_BOUNDARY_EXPORT void
65    Java_org_jni_1zero_samples_SampleUniqueAnnotations_nativeCallWithQualifiedObject(
66    JNIEnv* env,
67    jobject jcaller,
68    jlong nativePtr) {
69  Foo::Bar* native = reinterpret_cast<Foo::Bar*>(nativePtr);
70  CHECK_NATIVE_PTR(env, jcaller, native, "CallWithQualifiedObject");
71  return native->CallWithQualifiedObject(env, base::android::JavaParamRef<jobject>(env, jcaller));
72}
73
74
75static std::atomic<jmethodID> g_org_jni_1zero_samples_SampleUniqueAnnotations_useBar11(nullptr);
76static void Java_SampleUniqueAnnotations_useBar1(JNIEnv* env, const base::android::JavaRef<jobject>&
77    inner) {
78  jclass clazz = org_jni_1zero_samples_SampleUniqueAnnotations_clazz(env);
79  CHECK_CLAZZ(env, clazz,
80      org_jni_1zero_samples_SampleUniqueAnnotations_clazz(env));
81
82  jni_generator::JniJavaCallContextChecked call_context;
83  call_context.Init<
84      base::android::MethodID::TYPE_STATIC>(
85          env,
86          clazz,
87          "useBar1",
88          "(Lorg/jni_zero/samples/Bar1$Inner;)V",
89          &g_org_jni_1zero_samples_SampleUniqueAnnotations_useBar11);
90
91     env->CallStaticVoidMethod(clazz,
92          call_context.base.method_id, inner.obj());
93}
94
95#endif  // org_jni_zero_samples_SampleUniqueAnnotations_JNI
96