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

Unified Diff: webrtc/api/java/jni/jni_helpers.cc

Issue 1741723002: jni_helpers: Optimize IsNull() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 | « webrtc/api/java/jni/jni_helpers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/java/jni/jni_helpers.cc
diff --git a/webrtc/api/java/jni/jni_helpers.cc b/webrtc/api/java/jni/jni_helpers.cc
index cd150142a13d0772b3040d0bde7509a5f8976a23..32092e65f8b7e8a2c94cb69b393ccc5f4f2ebb2e 100644
--- a/webrtc/api/java/jni/jni_helpers.cc
+++ b/webrtc/api/java/jni/jni_helpers.cc
@@ -202,11 +202,8 @@ bool GetBooleanField(JNIEnv* jni, jobject object, jfieldID id) {
return b;
}
-// Java references to "null" can only be distinguished as such in C++ by
-// creating a local reference, so this helper wraps that logic.
bool IsNull(JNIEnv* jni, jobject obj) {
- ScopedLocalRefFrame local_ref_frame(jni);
- return jni->NewLocalRef(obj) == NULL;
+ return jni->IsSameObject(obj, nullptr);
}
// Given a UTF-8 encoded |native| string return a new (UTF-16) jstring.
« no previous file with comments | « webrtc/api/java/jni/jni_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698