Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Unified Diff: base/android/jni_generator/testMainDexFile.golden

Issue 2501193003: Selectively perform JNI registration in render processes on Android. (Closed)
Patch Set: Address Ted C comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/android/jni_generator/testMainDexFile.golden
diff --git a/base/android/jni_generator/testMainDexFile.golden b/base/android/jni_generator/testMainDexFile.golden
new file mode 100644
index 0000000000000000000000000000000000000000..cbb2a7d00cf30aaf6a8b20415cfe2113447850f7
--- /dev/null
+++ b/base/android/jni_generator/testMainDexFile.golden
@@ -0,0 +1,67 @@
+// 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/Bar
+
+#ifndef org_chromium_foo_Bar_JNI
+#define org_chromium_foo_Bar_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 kBarClassPath[] = "org/chromium/foo/Bar";
+// Leaking this jclass as we cannot use LazyInstance from some threads.
+base::subtle::AtomicWord g_Bar_clazz __attribute__((unused)) = 0;
+#define Bar_clazz(env) base::android::LazyGetClass(env, kBarClassPath, &g_Bar_clazz)
+
+} // namespace
+
+// Step 2: method stubs.
+JNI_GENERATOR_EXPORT jint Java_org_chromium_foo_Bar_nativeStaticMethod(JNIEnv*
+ env, jobject jcaller,
+ jlong nativeTest,
+ jint arg1) {
+ Test* native = reinterpret_cast<Test*>(nativeTest);
+ CHECK_NATIVE_PTR(env, jcaller, native, "StaticMethod", 0);
+ return native->StaticMethod(env, base::android::JavaParamRef<jobject>(env,
+ jcaller), arg1);
+}
+
+// Step 3: RegisterNatives.
+
+static const JNINativeMethod kMethodsBar[] = {
+ { "nativeStaticMethod",
+"("
+"J"
+"I"
+")"
+"I", reinterpret_cast<void*>(Java_org_chromium_foo_Bar_nativeStaticMethod) },
+};
+
+static bool RegisterNativesImpl(JNIEnv* env) {
+ if (jni_generator::ShouldSkipJniRegistration(true))
+ return true;
+
+ const int kMethodsBarSize = arraysize(kMethodsBar);
+
+ if (env->RegisterNatives(Bar_clazz(env),
+ kMethodsBar,
+ kMethodsBarSize) < 0) {
+ jni_generator::HandleRegistrationError(
+ env, Bar_clazz(env), __FILE__);
+ return false;
+ }
+
+ return true;
+}
+
+#endif // org_chromium_foo_Bar_JNI

Powered by Google App Engine
This is Rietveld 408576698