| Index: third_party/WebKit/Source/core/dom/ScopedWindowFocusAllowedIndicator.h
|
| diff --git a/third_party/WebKit/Source/core/dom/ScopedWindowFocusAllowedIndicator.h b/third_party/WebKit/Source/core/dom/ScopedWindowFocusAllowedIndicator.h
|
| index 7f6923722be0f5a61b696cc9520f5689e13cf73b..b52a3313727b235004b510230d481f1acd8a48f2 100644
|
| --- a/third_party/WebKit/Source/core/dom/ScopedWindowFocusAllowedIndicator.h
|
| +++ b/third_party/WebKit/Source/core/dom/ScopedWindowFocusAllowedIndicator.h
|
| @@ -5,7 +5,6 @@
|
| #ifndef ScopedWindowFocusAllowedIndicator_h
|
| #define ScopedWindowFocusAllowedIndicator_h
|
|
|
| -#include "core/dom/ContextLifecycleObserver.h"
|
| #include "core/dom/ExecutionContext.h"
|
| #include "wtf/Noncopyable.h"
|
|
|
| @@ -17,32 +16,17 @@ class ScopedWindowFocusAllowedIndicator final {
|
|
|
| public:
|
| explicit ScopedWindowFocusAllowedIndicator(ExecutionContext* executionContext)
|
| - : m_observer(new Observer(executionContext)) {}
|
| - ~ScopedWindowFocusAllowedIndicator() { m_observer->dispose(); }
|
| + : m_executionContext(executionContext) {
|
| + executionContext->allowWindowInteraction();
|
| + }
|
| + ~ScopedWindowFocusAllowedIndicator() {
|
| + m_executionContext->consumeWindowInteraction();
|
| + }
|
|
|
| private:
|
| - class Observer final : public GarbageCollected<Observer>,
|
| - public ContextLifecycleObserver {
|
| - USING_GARBAGE_COLLECTED_MIXIN(Observer);
|
| -
|
| - public:
|
| - explicit Observer(ExecutionContext* executionContext)
|
| - : ContextLifecycleObserver(executionContext) {
|
| - if (executionContext)
|
| - executionContext->allowWindowInteraction();
|
| - }
|
| -
|
| - void dispose() {
|
| - if (getExecutionContext())
|
| - getExecutionContext()->consumeWindowInteraction();
|
| - }
|
| - };
|
| -
|
| - // In Oilpan, destructors are not allowed to touch other on-heap objects.
|
| - // The Observer indirection is needed to keep
|
| - // ScopedWindowFocusAllowedIndicator off-heap and thus allows its destructor
|
| - // to call getExecutionContext()->consumeWindowInteraction().
|
| - Persistent<Observer> m_observer;
|
| + // This doesn't create a cycle because ScopedWindowFocusAllowedIndicator
|
| + // is used only on a machine stack.
|
| + Persistent<ExecutionContext> m_executionContext;
|
| };
|
|
|
| } // namespace blink
|
|
|