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

Side by Side Diff: base/android/jni_generator/java/src/org/chromium/example/jni_generator/SampleForTests.java

Issue 2022283002: Update jni_generator documentation removing GYP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/android/jni_generator/sample_for_tests.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.example.jni_generator; 5 package org.chromium.example.jni_generator;
6 6
7 import android.graphics.Rect; 7 import android.graphics.Rect;
8 8
9 import org.chromium.base.annotations.AccessedByNative; 9 import org.chromium.base.annotations.AccessedByNative;
10 import org.chromium.base.annotations.CalledByNative; 10 import org.chromium.base.annotations.CalledByNative;
11 import org.chromium.base.annotations.CalledByNativeUnchecked; 11 import org.chromium.base.annotations.CalledByNativeUnchecked;
12 import org.chromium.base.annotations.JNINamespace; 12 import org.chromium.base.annotations.JNINamespace;
13 import org.chromium.base.annotations.NativeClassQualifiedName; 13 import org.chromium.base.annotations.NativeClassQualifiedName;
14 14
15 import java.util.ArrayList; 15 import java.util.ArrayList;
16 import java.util.Iterator; 16 import java.util.Iterator;
17 import java.util.List; 17 import java.util.List;
18 18
19 // This class serves as a reference test for the bindings generator, and as exam ple documentation 19 // This class serves as a reference test for the bindings generator, and as exam ple documentation
20 // for how to use the jni generator. 20 // for how to use the jni generator.
21 // The C++ counter-part is sample_for_tests.cc. 21 // The C++ counter-part is sample_for_tests.cc.
22 // jni_generator.gyp has a jni_generator_tests target that will: 22 // jni_generator/BUILD.gn has a jni_generator_tests target that will:
23 // * Generate a header file for the JNI bindings based on this file. 23 // * Generate a header file for the JNI bindings based on this file.
24 // * Compile sample_for_tests.cc using the generated header file. 24 // * Compile sample_for_tests.cc using the generated header file.
25 // * link a native executable to prove the generated header + cc file are self -contained. 25 // * link a native executable to prove the generated header + cc file are self -contained.
26 // All comments are informational only, and are ignored by the jni generator. 26 // All comments are informational only, and are ignored by the jni generator.
27 // 27 //
28 // Binding C/C++ with Java is not trivial, specially when ownership and object l ifetime 28 // Binding C/C++ with Java is not trivial, specially when ownership and object l ifetime
29 // semantics needs to be managed across boundaries. 29 // semantics needs to be managed across boundaries.
30 // Following a few guidelines will make the code simpler and less buggy: 30 // Following a few guidelines will make the code simpler and less buggy:
31 // 31 //
32 // - Never write any JNI "by hand". Rely on the bindings generator to have a thi n 32 // - Never write any JNI "by hand". Rely on the bindings generator to have a thi n
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // Now, do something with element. 295 // Now, do something with element.
296 nativeAddStructB(mNativeCPPObject, element); 296 nativeAddStructB(mNativeCPPObject, element);
297 } 297 }
298 nativeIterateAndDoSomethingWithStructB(mNativeCPPObject); 298 nativeIterateAndDoSomethingWithStructB(mNativeCPPObject);
299 } 299 }
300 300
301 native void nativeAddStructB(long nativeCPPClass, InnerStructB b); 301 native void nativeAddStructB(long nativeCPPClass, InnerStructB b);
302 native void nativeIterateAndDoSomethingWithStructB(long nativeCPPClass); 302 native void nativeIterateAndDoSomethingWithStructB(long nativeCPPClass);
303 native String nativeReturnAString(long nativeCPPClass); 303 native String nativeReturnAString(long nativeCPPClass);
304 } 304 }
OLDNEW
« no previous file with comments | « no previous file | base/android/jni_generator/sample_for_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698