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

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

Issue 2507673002: Scheduler: Deprecate CancellableTaskFactory in favor of WebTaskRunner::postCancellableTask (2) (Closed)
Patch Set: address review comments Created 4 years, 1 month 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 | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunner.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7681e529192976c7b9090e671e09d9fb30cbfc3a..c08eec1d85ca5717edc294da5bd905514ccd0bf5 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -234,7 +234,6 @@
#include "platform/ScriptForbiddenScope.h"
#include "platform/network/ContentSecurityPolicyParsers.h"
#include "platform/network/HTTPParsers.h"
-#include "platform/scheduler/CancellableTaskFactory.h"
#include "platform/scroll/ScrollbarTheme.h"
#include "platform/text/PlatformLocale.h"
#include "platform/text/SegmentedString.h"
@@ -428,9 +427,6 @@ Document::Document(const DocumentInit& initializer,
m_paginatedForScreen(false),
m_compatibilityMode(NoQuirksMode),
m_compatibilityModeLocked(false),
- m_executeScriptsWaitingForResourcesTask(CancellableTaskFactory::create(
- this,
- &Document::executeScriptsWaitingForResources)),
m_hasAutofocused(false),
m_clearFocusedElementTimer(
TaskRunnerHelper::get(TaskType::Internal, this),
@@ -3270,9 +3266,14 @@ void Document::didRemoveAllPendingStylesheet() {
}
void Document::didLoadAllScriptBlockingResources() {
- TaskRunnerHelper::get(TaskType::Networking, this)
- ->postTask(BLINK_FROM_HERE,
- m_executeScriptsWaitingForResourcesTask->cancelAndCreate());
+ // Use wrapWeakPersistent because the task should not keep this Document alive
+ // just for executing scripts.
+ m_executeScriptsWaitingForResourcesTaskHandle =
+ TaskRunnerHelper::get(TaskType::Networking, this)
+ ->postCancellableTask(
+ BLINK_FROM_HERE,
+ WTF::bind(&Document::executeScriptsWaitingForResources,
+ wrapWeakPersistent(this)));
if (isHTMLDocument() && body()) {
// For HTML if we have no more stylesheets to load and we're past the body
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/ScriptRunner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698