This source file includes following definitions.
- addObserver
- removeObserver
- create
- notifyAddEventListener
- notifyRemoveEventListener
- notifyRemoveAllEventListeners
#include "config.h"
#include "core/frame/DOMWindowLifecycleNotifier.h"
namespace WebCore {
DOMWindowLifecycleNotifier::DOMWindowLifecycleNotifier(DOMWindow* context)
: LifecycleNotifier<DOMWindow>(context)
{
}
void DOMWindowLifecycleNotifier::addObserver(DOMWindowLifecycleNotifier::Observer* observer)
{
if (observer->observerType() == Observer::DOMWindowLifecycleObserverType) {
RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers);
m_windowObservers.add(static_cast<DOMWindowLifecycleObserver*>(observer));
}
LifecycleNotifier<DOMWindow>::addObserver(observer);
}
void DOMWindowLifecycleNotifier::removeObserver(DOMWindowLifecycleNotifier::Observer* observer)
{
if (observer->observerType() == Observer::DOMWindowLifecycleObserverType) {
RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers);
m_windowObservers.remove(static_cast<DOMWindowLifecycleObserver*>(observer));
}
LifecycleNotifier<DOMWindow>::removeObserver(observer);
}
PassOwnPtr<DOMWindowLifecycleNotifier> DOMWindowLifecycleNotifier::create(DOMWindow* context)
{
return adoptPtr(new DOMWindowLifecycleNotifier(context));
}
void DOMWindowLifecycleNotifier::notifyAddEventListener(DOMWindow* window, const AtomicString& eventType)
{
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
(*it)->didAddEventListener(window, eventType);
}
void DOMWindowLifecycleNotifier::notifyRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
{
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
(*it)->didRemoveEventListener(window, eventType);
}
void DOMWindowLifecycleNotifier::notifyRemoveAllEventListeners(DOMWindow* window)
{
TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers);
for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it)
(*it)->didRemoveAllEventListeners(window);
}
}