aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorenzo Colitti <lorenzo@google.com>2015-03-16 11:16:34 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-16 11:16:34 +0000
commitb6a93549e18a05e194611893f86d59e388205d05 (patch)
tree2f5000d42701406e4b4d474ae405c7ee1f67b60c
parentcac573472bccfc987ea2af8b5c69b890bca8baaf (diff)
parente33014630bb9a33ac59333c21dafad65809b1e39 (diff)
downloadandroid_libnativehelper-b6a93549e18a05e194611893f86d59e388205d05.tar.gz
android_libnativehelper-b6a93549e18a05e194611893f86d59e388205d05.tar.bz2
android_libnativehelper-b6a93549e18a05e194611893f86d59e388205d05.zip
am e3301463: Merge "Add JNI references for PacketSocketAddress."
* commit 'e33014630bb9a33ac59333c21dafad65809b1e39': Add JNI references for PacketSocketAddress.
-rw-r--r--JniConstants.cpp2
-rw-r--r--include/nativehelper/JniConstants.h10
2 files changed, 7 insertions, 5 deletions
diff --git a/JniConstants.cpp b/JniConstants.cpp
index 9ae7871..a07466d 100644
--- a/JniConstants.cpp
+++ b/JniConstants.cpp
@@ -55,6 +55,7 @@ jclass JniConstants::netlinkSocketAddressClass;
jclass JniConstants::objectClass;
jclass JniConstants::objectArrayClass;
jclass JniConstants::outputStreamClass;
+jclass JniConstants::packetSocketAddressClass;
jclass JniConstants::parsePositionClass;
jclass JniConstants::patternSyntaxExceptionClass;
jclass JniConstants::realToStringClass;
@@ -121,6 +122,7 @@ void JniConstants::init(JNIEnv* env) {
objectClass = findClass(env, "java/lang/Object");
objectArrayClass = findClass(env, "[Ljava/lang/Object;");
outputStreamClass = findClass(env, "java/io/OutputStream");
+ packetSocketAddressClass = findClass(env, "android/system/PacketSocketAddress");
parsePositionClass = findClass(env, "java/text/ParsePosition");
patternSyntaxExceptionClass = findClass(env, "java/util/regex/PatternSyntaxException");
realToStringClass = findClass(env, "java/lang/RealToString");
diff --git a/include/nativehelper/JniConstants.h b/include/nativehelper/JniConstants.h
index f5e2b35..2017e57 100644
--- a/include/nativehelper/JniConstants.h
+++ b/include/nativehelper/JniConstants.h
@@ -22,11 +22,10 @@
/**
* A cache to avoid calling FindClass at runtime.
*
- * Class lookup is relatively expensive (2.5us on passion-eng at the time of writing), so we do
- * all such lookups eagerly at startup. This means that code that never uses, say,
- * java.util.zip.Deflater still has to pay for the lookup, but it means that on a device the cost
- * is definitely paid during boot and amortized. A central cache also removes the temptation to
- * dynamically call FindClass rather than add a small cache to each file that needs one. Another
+ * Class lookup is relatively expensive, so we do these lookups at startup. This means that code
+ * that never uses, say, java.util.zip.Deflater still has to pay for the lookup, but it means that
+ * on device the cost is paid during boot and amortized. A central cache also removes the temptation
+ * to dynamically call FindClass rather than add a small cache to each file that needs one. Another
* cost is that each class cached here requires a global reference, though in practice we save
* enough by not having a global reference for each file that uses a class such as java.lang.String
* which is used in several files.
@@ -73,6 +72,7 @@ struct JniConstants {
static jclass objectClass;
static jclass objectArrayClass;
static jclass outputStreamClass;
+ static jclass packetSocketAddressClass;
static jclass parsePositionClass;
static jclass patternSyntaxExceptionClass;
static jclass realToStringClass;