Index: base/android/jni_helper.h |
diff --git a/base/android/jni_helper.h b/base/android/jni_helper.h |
index 61359ef1725ff0fd0b4a983724336fcef1dc404d..bd3579fc89929ef1333b43b2a0b41cfff5be4810 100644 |
--- a/base/android/jni_helper.h |
+++ b/base/android/jni_helper.h |
@@ -10,6 +10,9 @@ |
#include "base/android/scoped_java_ref.h" |
// Manages WeakGlobalRef lifecycle. |
+// This class is not thread-safe w.r.t. get() and reset(). Multiple threads may |
+// safely use get() concurrently, but if the user calls reset() (or of course, |
+// calls the destructor) they'll need to provide their own synchronization. |
class JavaObjectWeakGlobalRef { |
public: |
JavaObjectWeakGlobalRef(JNIEnv* env, jobject obj); |
@@ -17,6 +20,8 @@ class JavaObjectWeakGlobalRef { |
base::android::ScopedJavaLocalRef<jobject> get(JNIEnv* env) const; |
+ void reset(); |
+ |
private: |
jweak obj_; |
@@ -26,6 +31,6 @@ class JavaObjectWeakGlobalRef { |
// Get the real object stored in the weak reference returned as a |
// ScopedJavaLocalRef. |
base::android::ScopedJavaLocalRef<jobject> GetRealObject( |
- JNIEnv* env, jobject obj); |
+ JNIEnv* env, jweak obj); |
#endif // BASE_ANDROID_JNI_HELPER_H_ |