| Index: Source/platform/LifecycleNotifier.h
|
| diff --git a/Source/platform/LifecycleNotifier.h b/Source/platform/LifecycleNotifier.h
|
| index 57d684f009aa4b463b3ac7e83c32ac36dabbf581..3d64a697382b3e4436bafdfbdf42cb5e53155f6d 100644
|
| --- a/Source/platform/LifecycleNotifier.h
|
| +++ b/Source/platform/LifecycleNotifier.h
|
| @@ -47,14 +47,13 @@ public:
|
| return adoptPtr(new LifecycleNotifier(context));
|
| }
|
|
|
| -
|
| virtual ~LifecycleNotifier();
|
|
|
| -
|
| // FIXME: this won't need to be virtual anymore.
|
| virtual void addObserver(Observer*);
|
| virtual void removeObserver(Observer*);
|
|
|
| + void notifyContextWillBeDestroyed();
|
| bool isIteratingOverObservers() const { return m_iterating != IteratingNone; }
|
|
|
| protected:
|
| @@ -98,6 +97,17 @@ inline LifecycleNotifier<T>::~LifecycleNotifier()
|
| }
|
|
|
| template<typename T>
|
| +inline void LifecycleNotifier<T>::notifyContextWillBeDestroyed()
|
| +{
|
| + TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverAll);
|
| + for (typename ObserverSet::iterator it = m_observers.begin(); it != m_observers.end(); it = m_observers.begin()) {
|
| + Observer* observer = *it;
|
| + ASSERT(observer->lifecycleContext() == m_context);
|
| + observer->contextWillBeDestroyed();
|
| + }
|
| +}
|
| +
|
| +template<typename T>
|
| inline void LifecycleNotifier<T>::addObserver(typename LifecycleNotifier<T>::Observer* observer)
|
| {
|
| RELEASE_ASSERT(m_iterating != IteratingOverAll);
|
|
|