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 1e47f442157510b83b9c9d82cd55cf388366721c..9eab14d099bf31c2a2d1a0d8989757fab9b51a2a 100644 |
| --- a/third_party/WebKit/Source/core/dom/Document.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp |
| @@ -76,6 +76,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" |
| @@ -602,6 +603,11 @@ void Document::dispose() |
| if (svgExtensions()) |
| accessSVGExtensions().pauseAnimations(); |
| + if (m_intersectionObserverController) { |
| + m_intersectionObserverController->dispose(); |
| + m_intersectionObserverController.clear(); |
| + } |
| + |
| m_lifecycle.advanceTo(DocumentLifecycle::Disposed); |
| DocumentLifecycleNotifier::notifyDocumentWasDisposed(); |
| @@ -4492,11 +4498,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; |
| } |
| @@ -4972,6 +4974,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() |
|
esprehn
2015/12/17 01:40:28
We usually make these return a reference since it
szager1
2015/12/17 20:27:25
Done.
|
| +{ |
| + if (!m_intersectionObserverController) |
| + m_intersectionObserverController = new IntersectionObserverController(); |
| + return m_intersectionObserverController.get(); |
| +} |
| + |
| void Document::reportBlockedScriptExecutionToInspector(const String& directiveText) |
| { |
| InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText); |
| @@ -5029,6 +5047,8 @@ void Document::tasksWereResumed() |
| m_scriptedAnimationController->resume(); |
| MutationObserver::resumeSuspendedObservers(); |
| + if (m_intersectionObserverController) |
| + m_intersectionObserverController->resumeSuspendedIntersectionObservers(); |
| if (m_domWindow) |
| DOMWindowPerformance::performance(*m_domWindow)->resumeSuspendedObservers(); |
| } |
| @@ -5822,6 +5842,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); |