Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Document.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
| index f0b373487b502c3973dbca8ac8075b92b10eb91b..c0431a9a763e1b044e25aadb0514b1bc0dcf8d20 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -75,6 +75,7 @@ |
| #include "core/dom/ExceptionCode.h" |
| #include "core/dom/ExecutionContextTask.h" |
| #include "core/dom/FrameRequestCallback.h" |
| +#include "core/dom/IntersectionObserverController.h" |
| #include "core/dom/LayoutTreeBuilderTraversal.h" |
| #include "core/dom/MainThreadTaskRunner.h" |
| #include "core/dom/Microtask.h" |
| @@ -608,6 +609,11 @@ void Document::dispose() |
| if (svgExtensions()) |
| accessSVGExtensions().pauseAnimations(); |
| + if (m_intersectionObserverController) { |
| + m_intersectionObserverController->dispose(); |
| + m_intersectionObserverController.clear(); |
| + } |
|
haraken
2015/12/22 01:13:29
I think we should call these in Document::detach,
szager1
2015/12/22 07:53:40
In oilpan, it should not be necessary to run this
|
| + |
| m_lifecycle.advanceTo(DocumentLifecycle::Disposed); |
| DocumentLifecycleNotifier::notifyDocumentWasDisposed(); |
| @@ -4579,11 +4585,7 @@ WeakPtrWillBeRawPtr<Document> Document::contextDocument() |
| if (m_contextDocument) |
| return m_contextDocument; |
| if (m_frame) { |
| -#if ENABLE(OILPAN) |
| - return this; |
| -#else |
| - return m_weakFactory.createWeakPtr(); |
| -#endif |
| + return createWeakPtr(); |
| } |
| return nullptr; |
| } |
| @@ -5059,6 +5061,22 @@ void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) |
| m_haveExplicitlyDisabledDNSPrefetch = true; |
| } |
| +WeakPtrWillBeRawPtr<Document> Document::createWeakPtr() |
| +{ |
| +#if ENABLE(OILPAN) |
| + return this; |
| +#else |
| + return m_weakFactory.createWeakPtr(); |
| +#endif |
| +} |
| + |
| +IntersectionObserverController& Document::intersectionObserverController() |
|
haraken
2015/12/22 01:13:29
intersectionObserverController() => ensureIntersec
szager1
2015/12/22 07:53:40
Done.
|
| +{ |
| + if (!m_intersectionObserverController) |
| + m_intersectionObserverController = new IntersectionObserverController(); |
| + return *m_intersectionObserverController; |
| +} |
| + |
| void Document::reportBlockedScriptExecutionToInspector(const String& directiveText) |
| { |
| InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
| @@ -5116,6 +5134,8 @@ void Document::tasksWereResumed() |
| m_scriptedAnimationController->resume(); |
| MutationObserver::resumeSuspendedObservers(); |
| + if (m_intersectionObserverController) |
| + m_intersectionObserverController->resumeSuspendedIntersectionObservers(); |
| if (m_domWindow) |
| DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObservers(); |
| } |
| @@ -5862,6 +5882,7 @@ DEFINE_TRACE(Document) |
| visitor->trace(m_compositorPendingAnimations); |
| visitor->trace(m_contextDocument); |
| visitor->trace(m_canvasFontCache); |
| + visitor->trace(m_intersectionObserverController); |
| WillBeHeapSupplementable<Document>::trace(visitor); |
| #endif |
| TreeScope::trace(visitor); |