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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 #include "platform/EventDispatchForbiddenScope.h" 227 #include "platform/EventDispatchForbiddenScope.h"
228 #include "platform/Histogram.h" 228 #include "platform/Histogram.h"
229 #include "platform/InstanceCounters.h" 229 #include "platform/InstanceCounters.h"
230 #include "platform/Language.h" 230 #include "platform/Language.h"
231 #include "platform/LengthFunctions.h" 231 #include "platform/LengthFunctions.h"
232 #include "platform/PluginScriptForbiddenScope.h" 232 #include "platform/PluginScriptForbiddenScope.h"
233 #include "platform/RuntimeEnabledFeatures.h" 233 #include "platform/RuntimeEnabledFeatures.h"
234 #include "platform/ScriptForbiddenScope.h" 234 #include "platform/ScriptForbiddenScope.h"
235 #include "platform/network/ContentSecurityPolicyParsers.h" 235 #include "platform/network/ContentSecurityPolicyParsers.h"
236 #include "platform/network/HTTPParsers.h" 236 #include "platform/network/HTTPParsers.h"
237 #include "platform/scheduler/CancellableTaskFactory.h"
238 #include "platform/scroll/ScrollbarTheme.h" 237 #include "platform/scroll/ScrollbarTheme.h"
239 #include "platform/text/PlatformLocale.h" 238 #include "platform/text/PlatformLocale.h"
240 #include "platform/text/SegmentedString.h" 239 #include "platform/text/SegmentedString.h"
241 #include "platform/tracing/TraceEvent.h" 240 #include "platform/tracing/TraceEvent.h"
242 #include "platform/weborigin/OriginAccessEntry.h" 241 #include "platform/weborigin/OriginAccessEntry.h"
243 #include "platform/weborigin/SchemeRegistry.h" 242 #include "platform/weborigin/SchemeRegistry.h"
244 #include "platform/weborigin/SecurityOrigin.h" 243 #include "platform/weborigin/SecurityOrigin.h"
245 #include "public/platform/Platform.h" 244 #include "public/platform/Platform.h"
246 #include "public/platform/WebAddressSpace.h" 245 #include "public/platform/WebAddressSpace.h"
247 #include "public/platform/WebFrameScheduler.h" 246 #include "public/platform/WebFrameScheduler.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 m_frame(initializer.frame()), 420 m_frame(initializer.frame()),
422 m_domWindow(m_frame ? m_frame->localDOMWindow() : 0), 421 m_domWindow(m_frame ? m_frame->localDOMWindow() : 0),
423 m_importsController(this, initializer.importsController()), 422 m_importsController(this, initializer.importsController()),
424 m_contextFeatures(ContextFeatures::defaultSwitch()), 423 m_contextFeatures(ContextFeatures::defaultSwitch()),
425 m_wellFormed(false), 424 m_wellFormed(false),
426 m_implementation(this, nullptr), 425 m_implementation(this, nullptr),
427 m_printing(NotPrinting), 426 m_printing(NotPrinting),
428 m_paginatedForScreen(false), 427 m_paginatedForScreen(false),
429 m_compatibilityMode(NoQuirksMode), 428 m_compatibilityMode(NoQuirksMode),
430 m_compatibilityModeLocked(false), 429 m_compatibilityModeLocked(false),
431 m_executeScriptsWaitingForResourcesTask(CancellableTaskFactory::create(
432 this,
433 &Document::executeScriptsWaitingForResources)),
434 m_hasAutofocused(false), 430 m_hasAutofocused(false),
435 m_clearFocusedElementTimer( 431 m_clearFocusedElementTimer(
436 TaskRunnerHelper::get(TaskType::Internal, this), 432 TaskRunnerHelper::get(TaskType::Internal, this),
437 this, 433 this,
438 &Document::clearFocusedElementTimerFired), 434 &Document::clearFocusedElementTimerFired),
439 m_domTreeVersion(++s_globalTreeVersion), 435 m_domTreeVersion(++s_globalTreeVersion),
440 m_styleVersion(0), 436 m_styleVersion(0),
441 m_listenerTypes(0), 437 m_listenerTypes(0),
442 m_mutationObserverTypes(0), 438 m_mutationObserverTypes(0),
443 m_styleEngine(this, nullptr), 439 m_styleEngine(this, nullptr),
(...skipping 2817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 3257
3262 // Only imports on master documents can trigger rendering. 3258 // Only imports on master documents can trigger rendering.
3263 if (HTMLImportLoader* import = importLoader()) 3259 if (HTMLImportLoader* import = importLoader())
3264 import->didRemoveAllPendingStylesheet(); 3260 import->didRemoveAllPendingStylesheet();
3265 if (!haveImportsLoaded()) 3261 if (!haveImportsLoaded())
3266 return; 3262 return;
3267 didLoadAllScriptBlockingResources(); 3263 didLoadAllScriptBlockingResources();
3268 } 3264 }
3269 3265
3270 void Document::didLoadAllScriptBlockingResources() { 3266 void Document::didLoadAllScriptBlockingResources() {
3271 TaskRunnerHelper::get(TaskType::Networking, this) 3267 // wrapWeakPersistent(this) is safe because a posted task is canceled when the
3272 ->postTask(BLINK_FROM_HERE, 3268 // 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
3273 m_executeScriptsWaitingForResourcesTask->cancelAndCreate()); 3269 m_executeScriptsWaitingForResourcesTaskHandle =
3270 TaskRunnerHelper::get(TaskType::Networking, this)
3271 ->postCancellableTask(
3272 BLINK_FROM_HERE,
3273 WTF::bind(&Document::executeScriptsWaitingForResources,
3274 wrapWeakPersistent(this)));
3274 3275
3275 if (isHTMLDocument() && body()) { 3276 if (isHTMLDocument() && body()) {
3276 // For HTML if we have no more stylesheets to load and we're past the body 3277 // For HTML if we have no more stylesheets to load and we're past the body
3277 // tag, we should have something to paint so resume. 3278 // tag, we should have something to paint so resume.
3278 beginLifecycleUpdatesIfRenderingReady(); 3279 beginLifecycleUpdatesIfRenderingReady();
3279 } else if (!isHTMLDocument() && documentElement()) { 3280 } else if (!isHTMLDocument() && documentElement()) {
3280 // For non-HTML there is no body so resume as soon as the sheets are loaded. 3281 // For non-HTML there is no body so resume as soon as the sheets are loaded.
3281 beginLifecycleUpdatesIfRenderingReady(); 3282 beginLifecycleUpdatesIfRenderingReady();
3282 } 3283 }
3283 3284
(...skipping 3152 matching lines...) Expand 10 before | Expand all | Expand 10 after
6436 } 6437 }
6437 6438
6438 void showLiveDocumentInstances() { 6439 void showLiveDocumentInstances() {
6439 WeakDocumentSet& set = liveDocumentSet(); 6440 WeakDocumentSet& set = liveDocumentSet();
6440 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6441 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6441 for (Document* document : set) 6442 for (Document* document : set)
6442 fprintf(stderr, "- Document %p URL: %s\n", document, 6443 fprintf(stderr, "- Document %p URL: %s\n", document,
6443 document->url().getString().utf8().data()); 6444 document->url().getString().utf8().data());
6444 } 6445 }
6445 #endif 6446 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698