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

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

Issue 2507673002: Scheduler: Deprecate CancellableTaskFactory in favor of WebTaskRunner::postCancellableTask (2) (Closed)
Patch Set: rebase 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
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 cd62e65908154b0f7b9b74d89fec2e3f860e652c..a0a49654aed5a9f85546217178bc1feedb54d138 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),
@@ -3268,9 +3264,14 @@ void Document::didRemoveAllPendingStylesheet() {
}
void Document::didLoadAllScriptBlockingResources() {
- TaskRunnerHelper::get(TaskType::Networking, this)
- ->postTask(BLINK_FROM_HERE,
- m_executeScriptsWaitingForResourcesTask->cancelAndCreate());
+ // wrapWeakPersistent(this) is safe because a posted task is canceled when the
+ // task handle is destroyed on the dtor of this Document.
haraken 2016/11/16 11:37:20 tzik@: Should we use wrapWeakPersistent? Or wrapPe
tzik 2016/11/17 06:20:14 That depends on the context: We should use wrapPer
haraken 2016/11/17 06:35:19 Makes sense.
nhiroki 2016/11/17 08:10:15 Thank you for the clarification. Added the comment
+ 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

Powered by Google App Engine
This is Rietveld 408576698