| Index: base/observer_list.h
|
| ===================================================================
|
| --- base/observer_list.h (revision 88283)
|
| +++ base/observer_list.h (working copy)
|
| @@ -12,7 +12,6 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/logging.h"
|
| -#include "base/memory/weak_ptr.h"
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
| //
|
| @@ -62,8 +61,7 @@
|
| class ObserverListThreadSafe;
|
|
|
| template <class ObserverType>
|
| -class ObserverListBase
|
| - : public base::SupportsWeakPtr<ObserverListBase<ObserverType> > {
|
| +class ObserverListBase {
|
| public:
|
| // Enumeration of which observers are notified.
|
| enum NotificationType {
|
| @@ -81,23 +79,21 @@
|
| class Iterator {
|
| public:
|
| Iterator(ObserverListBase<ObserverType>& list)
|
| - : list_(list.AsWeakPtr()),
|
| + : list_(list),
|
| index_(0),
|
| max_index_(list.type_ == NOTIFY_ALL ?
|
| std::numeric_limits<size_t>::max() :
|
| list.observers_.size()) {
|
| - ++list_->notify_depth_;
|
| + ++list_.notify_depth_;
|
| }
|
|
|
| ~Iterator() {
|
| - if (list_ && --list_->notify_depth_ == 0)
|
| - list_->Compact();
|
| + if (--list_.notify_depth_ == 0)
|
| + list_.Compact();
|
| }
|
|
|
| ObserverType* GetNext() {
|
| - if (!list_)
|
| - return NULL;
|
| - ListType& observers = list_->observers_;
|
| + ListType& observers = list_.observers_;
|
| // Advance if the current element is null
|
| size_t max_index = std::min(max_index_, observers.size());
|
| while (index_ < max_index && !observers[index_])
|
| @@ -106,7 +102,7 @@
|
| }
|
|
|
| private:
|
| - base::WeakPtr<ObserverListBase<ObserverType> > list_;
|
| + ObserverListBase<ObserverType>& list_;
|
| size_t index_;
|
| size_t max_index_;
|
| };
|
|
|