| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index 0f98d181f0a27fe4b9b2eea4ce4dc67671d68113..37abe001fa96fab12f062a4d7ccadd0e9066fdef 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -212,6 +212,7 @@
|
| #include "public/platform/Platform.h"
|
| #include "wtf/CurrentTime.h"
|
| #include "wtf/DateMath.h"
|
| +#include "wtf/Functional.h"
|
| #include "wtf/HashFunctions.h"
|
| #include "wtf/MainThread.h"
|
| #include "wtf/StdLibExtras.h"
|
| @@ -363,6 +364,25 @@ private:
|
| }
|
| };
|
|
|
| +} // namespace blink
|
| +
|
| +namespace WTF {
|
| +
|
| +#if ENABLE(OILPAN)
|
| +// NOTE this is to prevent Document::m_executeScriptsWaitingForResourcesTask from leaking.
|
| +template<>
|
| +struct PointerParamStorageTraits<blink::Document*, true> {
|
| + using StorageType = blink::CrossThreadWeakPersistent<blink::Document>;
|
| +
|
| + static StorageType wrap(blink::Document* value) { return value; }
|
| + static blink::Document* unwrap(const StorageType& value) { return value.get(); }
|
| +};
|
| +#endif
|
| +
|
| +} // namespace WTF
|
| +
|
| +namespace blink {
|
| +
|
| Document::Document(const DocumentInit& initializer, DocumentClassFlags documentClasses)
|
| : ContainerNode(0, CreateDocument)
|
| , TreeScope(*this)
|
| @@ -380,7 +400,7 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC
|
| , m_paginatedForScreen(false)
|
| , m_compatibilityMode(NoQuirksMode)
|
| , m_compatibilityModeLocked(false)
|
| - , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWaitingForResourcesTimerFired)
|
| + , m_executeScriptsWaitingForResourcesTask(WTF::bind(&Document::executeScriptsWaitingForResources, this))
|
| , m_hasAutofocused(false)
|
| , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired)
|
| , m_domTreeVersion(++s_globalTreeVersion)
|
| @@ -2956,7 +2976,8 @@ void Document::didRemoveAllPendingStylesheet()
|
|
|
| void Document::didLoadAllScriptBlockingResources()
|
| {
|
| - m_executeScriptsWaitingForResourcesTimer.startOneShot(0, FROM_HERE);
|
| + Platform::current()->currentThread()->scheduler()->postLoadingTask(
|
| + FROM_HERE, m_executeScriptsWaitingForResourcesTask.cancelAndCreate());
|
|
|
| if (frame())
|
| frame()->loader().client()->didRemoveAllPendingStylesheet();
|
| @@ -2965,7 +2986,7 @@ void Document::didLoadAllScriptBlockingResources()
|
| view()->processUrlFragment(m_url);
|
| }
|
|
|
| -void Document::executeScriptsWaitingForResourcesTimerFired(Timer<Document>*)
|
| +void Document::executeScriptsWaitingForResources()
|
| {
|
| if (!isRenderingReady())
|
| return;
|
|
|