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

Unified Diff: base/android/jni_weak_ref.h

Issue 2485513003: Rename JavaObjectWeakGlobalRef::is_empty to avoid misuse. (Closed)
Patch Set: Created 4 years, 1 month 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_weak_ref.h
diff --git a/base/android/jni_weak_ref.h b/base/android/jni_weak_ref.h
index 2ae5cce02755c2833a2ab97acd71428a63cec2a5..223c47b2a2a5bd2fd10d392b0e2517a61ebb6267 100644
--- a/base/android/jni_weak_ref.h
+++ b/base/android/jni_weak_ref.h
@@ -29,7 +29,11 @@ class BASE_EXPORT JavaObjectWeakGlobalRef {
base::android::ScopedJavaLocalRef<jobject> get(JNIEnv* env) const;
- bool is_empty() const { return obj_ == nullptr; }
+ // Returns true if the weak reference has not been initialized to point at
+ // an object (or ḣas had reset() called).
+ // Do not call this to test if the object referred to still exists! The weak
+ // reference remains initialized even if the target object has been collected.
+ bool is_uninitialized() const { return obj_ == nullptr; }
void reset();

Powered by Google App Engine
This is Rietveld 408576698