Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Unified Diff: Source/core/dom/Document.cpp

Issue 1312353004: (Reland) Make m_executeScriptsWaitingForResourcesTimer a loading task (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add #if ENABLE(OILPAN) Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698