mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 16:26:10 +03:00
67 lines
2.2 KiB
Plaintext
67 lines
2.2 KiB
Plaintext
|
// 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/foo/Foo
|
||
|
|
||
|
#ifndef org_chromium_foo_Foo_JNI
|
||
|
#define org_chromium_foo_Foo_JNI
|
||
|
|
||
|
#include <jni.h>
|
||
|
|
||
|
#include "base/android/jni_generator/jni_generator_helper.h"
|
||
|
|
||
|
// Step 1: forward declarations.
|
||
|
JNI_REGISTRATION_EXPORT extern const char kClassPath_org_chromium_foo_Foo[];
|
||
|
const char kClassPath_org_chromium_foo_Foo[] = "org/chromium/foo/Foo";
|
||
|
|
||
|
// Leaking this jclass as we cannot use LazyInstance from some threads.
|
||
|
JNI_REGISTRATION_EXPORT base::subtle::AtomicWord g_org_chromium_foo_Foo_clazz =
|
||
|
0;
|
||
|
#ifndef org_chromium_foo_Foo_clazz_defined
|
||
|
#define org_chromium_foo_Foo_clazz_defined
|
||
|
inline jclass org_chromium_foo_Foo_clazz(JNIEnv* env) {
|
||
|
return base::android::LazyGetClass(env, kClassPath_org_chromium_foo_Foo,
|
||
|
&g_org_chromium_foo_Foo_clazz);
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
// Step 2: method stubs.
|
||
|
|
||
|
static void DoSomething(JNIEnv* env, const base::android::JavaParamRef<jclass>&
|
||
|
jcaller,
|
||
|
const base::android::JavaParamRef<jobject>& callback);
|
||
|
|
||
|
JNI_GENERATOR_EXPORT void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv*
|
||
|
env, jclass jcaller,
|
||
|
jobject callback) {
|
||
|
return DoSomething(env, base::android::JavaParamRef<jclass>(env, jcaller),
|
||
|
base::android::JavaParamRef<jobject>(env, callback));
|
||
|
}
|
||
|
|
||
|
static base::subtle::AtomicWord g_org_chromium_foo_Foo_calledByNative = 0;
|
||
|
static void Java_Foo_calledByNative(JNIEnv* env, const
|
||
|
base::android::JavaRef<jobject>& callback) {
|
||
|
CHECK_CLAZZ(env, org_chromium_foo_Foo_clazz(env),
|
||
|
org_chromium_foo_Foo_clazz(env));
|
||
|
jmethodID method_id =
|
||
|
base::android::MethodID::LazyGet<
|
||
|
base::android::MethodID::TYPE_STATIC>(
|
||
|
env, org_chromium_foo_Foo_clazz(env),
|
||
|
"calledByNative",
|
||
|
"("
|
||
|
"Lorg/chromium/foo/Bar$Callback;"
|
||
|
")"
|
||
|
"V",
|
||
|
&g_org_chromium_foo_Foo_calledByNative);
|
||
|
|
||
|
env->CallStaticVoidMethod(org_chromium_foo_Foo_clazz(env),
|
||
|
method_id, callback.obj());
|
||
|
jni_generator::CheckException(env);
|
||
|
}
|
||
|
|
||
|
#endif // org_chromium_foo_Foo_JNI
|