Index: base/memory/weak_ptr.h |
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h |
index abda1af2eaa7e0abf54a9a79bd0d9f7a4a526538..792dc0f35a41a87ad9c1c0e185a453c260c05db6 100644 |
--- a/base/memory/weak_ptr.h |
+++ b/base/memory/weak_ptr.h |
@@ -69,7 +69,7 @@ class BASE_EXPORT WeakReference { |
// via base::WeakPtr::~WeakPtr(). |
class Flag : public RefCountedThreadSafe<Flag> { |
public: |
- explicit Flag(Flag** handle); |
+ explicit Flag(); |
void Invalidate(); |
bool IsValid() const; |
@@ -82,11 +82,11 @@ class BASE_EXPORT WeakReference { |
~Flag(); |
ThreadChecker thread_checker_; |
- Flag** handle_; |
+ bool valid_; |
darin (slow to review)
2011/08/18 18:29:06
nit: valid_ -> is_valid_
|
}; |
WeakReference(); |
- WeakReference(Flag* flag); |
+ WeakReference(scoped_refptr<Flag> flag); |
darin (slow to review)
2011/08/18 18:29:06
nit: WeakReference(const scoped_refptr<Flag>& flag
willchan no longer on Chromium
2011/08/18 19:14:12
While I'm glad you seem to have this preference he
|
~WeakReference(); |
bool is_valid() const; |
@@ -103,7 +103,7 @@ class BASE_EXPORT WeakReferenceOwner { |
WeakReference GetRef() const; |
bool HasRefs() const { |
- return flag_ != NULL; |
+ return flag_.get() && !flag_->HasOneRef(); |
} |
void Invalidate(); |
@@ -114,7 +114,7 @@ class BASE_EXPORT WeakReferenceOwner { |
} |
private: |
- mutable WeakReference::Flag* flag_; |
+ mutable scoped_refptr<WeakReference::Flag> flag_; |
}; |
// This class simplifies the implementation of WeakPtr's type conversion |