| Index: Source/core/dom/ExecutionContext.cpp
|
| diff --git a/Source/core/dom/ExecutionContext.cpp b/Source/core/dom/ExecutionContext.cpp
|
| index e7e379d9a76a0bd35b25b23ff44bd4a33f175b23..9f0f684a38618eda54c024f8c1ef468c62082023 100644
|
| --- a/Source/core/dom/ExecutionContext.cpp
|
| +++ b/Source/core/dom/ExecutionContext.cpp
|
| @@ -28,6 +28,7 @@
|
| #include "config.h"
|
| #include "core/dom/ExecutionContext.h"
|
|
|
| +#include "core/dom/ContextLifecycleNotifier.h"
|
| #include "core/dom/ExecutionContextTask.h"
|
| #include "core/events/ErrorEvent.h"
|
| #include "core/events/EventTarget.h"
|
| @@ -66,13 +67,12 @@ public:
|
| };
|
|
|
| ExecutionContext::ExecutionContext()
|
| - : ContextLifecycleNotifier(this)
|
| - , m_circularSequentialID(0)
|
| + : m_circularSequentialID(0)
|
| , m_inDispatchErrorEvent(false)
|
| , m_activeDOMObjectsAreSuspended(false)
|
| , m_activeDOMObjectsAreStopped(false)
|
| , m_strictMixedContentCheckingEnforced(false)
|
| - , m_windowInteractionTokens(0)
|
| + , m_windowFocusTokens(0)
|
| {
|
| }
|
|
|
| @@ -80,10 +80,15 @@ ExecutionContext::~ExecutionContext()
|
| {
|
| }
|
|
|
| +bool ExecutionContext::hasPendingActivity()
|
| +{
|
| + return lifecycleNotifier().hasPendingActivity();
|
| +}
|
| +
|
| void ExecutionContext::suspendActiveDOMObjects()
|
| {
|
| ASSERT(!m_activeDOMObjectsAreSuspended);
|
| - notifySuspendingActiveDOMObjects();
|
| + lifecycleNotifier().notifySuspendingActiveDOMObjects();
|
| m_activeDOMObjectsAreSuspended = true;
|
| }
|
|
|
| @@ -91,18 +96,18 @@ void ExecutionContext::resumeActiveDOMObjects()
|
| {
|
| ASSERT(m_activeDOMObjectsAreSuspended);
|
| m_activeDOMObjectsAreSuspended = false;
|
| - notifyResumingActiveDOMObjects();
|
| + lifecycleNotifier().notifyResumingActiveDOMObjects();
|
| }
|
|
|
| void ExecutionContext::stopActiveDOMObjects()
|
| {
|
| m_activeDOMObjectsAreStopped = true;
|
| - notifyStoppingActiveDOMObjects();
|
| + lifecycleNotifier().notifyStoppingActiveDOMObjects();
|
| }
|
|
|
| unsigned ExecutionContext::activeDOMObjectCount()
|
| {
|
| - return activeDOMObjects().size();
|
| + return lifecycleNotifier().activeDOMObjects().size();
|
| }
|
|
|
| void ExecutionContext::suspendScheduledTasks()
|
| @@ -119,7 +124,7 @@ void ExecutionContext::resumeScheduledTasks()
|
|
|
| void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object)
|
| {
|
| - ASSERT(contains(object));
|
| + ASSERT(lifecycleNotifier().contains(object));
|
| // Ensure all ActiveDOMObjects are suspended also newly created ones.
|
| if (m_activeDOMObjectsAreSuspended)
|
| object->suspend();
|
| @@ -206,24 +211,39 @@ KURL ExecutionContext::completeURL(const String& url) const
|
| return virtualCompleteURL(url);
|
| }
|
|
|
| -void ExecutionContext::allowWindowInteraction()
|
| +PassOwnPtr<LifecycleNotifier<ExecutionContext> > ExecutionContext::createLifecycleNotifier()
|
| +{
|
| + return ContextLifecycleNotifier::create(this);
|
| +}
|
| +
|
| +ContextLifecycleNotifier& ExecutionContext::lifecycleNotifier()
|
| +{
|
| + return static_cast<ContextLifecycleNotifier&>(LifecycleContext<ExecutionContext>::lifecycleNotifier());
|
| +}
|
| +
|
| +bool ExecutionContext::isIteratingOverObservers() const
|
| +{
|
| + return m_lifecycleNotifier && m_lifecycleNotifier->isIteratingOverObservers();
|
| +}
|
| +
|
| +void ExecutionContext::allowWindowFocus()
|
| {
|
| - ++m_windowInteractionTokens;
|
| + ++m_windowFocusTokens;
|
| }
|
|
|
| -void ExecutionContext::consumeWindowInteraction()
|
| +void ExecutionContext::consumeWindowFocus()
|
| {
|
| - if (m_windowInteractionTokens == 0)
|
| + if (m_windowFocusTokens == 0)
|
| return;
|
| - --m_windowInteractionTokens;
|
| + --m_windowFocusTokens;
|
| }
|
|
|
| -bool ExecutionContext::isWindowInteractionAllowed() const
|
| +bool ExecutionContext::isWindowFocusAllowed() const
|
| {
|
| // FIXME: WindowFocusAllowedIndicator::windowFocusAllowed() is temporary,
|
| // it will be removed as soon as WebScopedWindowFocusAllowedIndicator will
|
| // be updated to not use WindowFocusAllowedIndicator.
|
| - return m_windowInteractionTokens > 0 || WindowFocusAllowedIndicator::windowFocusAllowed();
|
| + return m_windowFocusTokens > 0 || WindowFocusAllowedIndicator::windowFocusAllowed();
|
| }
|
|
|
| void ExecutionContext::trace(Visitor* visitor)
|
| @@ -233,7 +253,7 @@ void ExecutionContext::trace(Visitor* visitor)
|
| visitor->trace(m_publicURLManager);
|
| HeapSupplementable<ExecutionContext>::trace(visitor);
|
| #endif
|
| - ContextLifecycleNotifier::trace(visitor);
|
| + LifecycleContext<ExecutionContext>::trace(visitor);
|
| }
|
|
|
| } // namespace blink
|
|
|