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

Unified Diff: base/android/jni_helper.h

Issue 10827125: Use JavaObjectWeakGlobalRef in ContentViewCore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | base/android/jni_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « no previous file | base/android/jni_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698