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

Unified Diff: base/android/jni_generator/sample_for_tests.cc

Issue 1123343005: Improve jni_generator sample documentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge TOT Created 5 years, 7 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
« no previous file with comments | « base/android/jni_generator/sample_for_tests.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_generator/sample_for_tests.cc
diff --git a/base/android/jni_generator/sample_for_tests.cc b/base/android/jni_generator/sample_for_tests.cc
index 6707742ed01a7087be83cc9c38aa5fe77ce9931f..3c5ca028906c847e1b1793744854c0e48600811a 100644
--- a/base/android/jni_generator/sample_for_tests.cc
+++ b/base/android/jni_generator/sample_for_tests.cc
@@ -7,8 +7,10 @@
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/android/scoped_java_ref.h"
-#include "jni/SampleForTests_jni.h"
-
+// Generated file for JNI bindings from C++ to Java @CalledByNative methods.
+// Only to be included in one .cc file.
+// Name is based on the java file name: *.java -> jni/*_jni.h
+#include "jni/SampleForTests_jni.h" // Generated by JNI.
using base::android::AttachCurrentThread;
using base::android::ScopedJavaLocalRef;
@@ -26,6 +28,11 @@ CPPClass::CPPClass() {
CPPClass::~CPPClass() {
}
+// static
+bool CPPClass::RegisterJNI(JNIEnv* env) {
+ return RegisterNativesImpl(env); // Generated in SampleForTests_jni.h
+}
+
void CPPClass::Destroy(JNIEnv* env, jobject obj) {
delete this;
}
« no previous file with comments | « base/android/jni_generator/sample_for_tests.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698