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

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: 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 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 2819 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 3259
3264 // Only imports on master documents can trigger rendering. 3260 // Only imports on master documents can trigger rendering.
3265 if (HTMLImportLoader* import = importLoader()) 3261 if (HTMLImportLoader* import = importLoader())
3266 import->didRemoveAllPendingStylesheet(); 3262 import->didRemoveAllPendingStylesheet();
3267 if (!haveImportsLoaded()) 3263 if (!haveImportsLoaded())
3268 return; 3264 return;
3269 didLoadAllScriptBlockingResources(); 3265 didLoadAllScriptBlockingResources();
3270 } 3266 }
3271 3267
3272 void Document::didLoadAllScriptBlockingResources() { 3268 void Document::didLoadAllScriptBlockingResources() {
3273 TaskRunnerHelper::get(TaskType::Networking, this) 3269 // Use wrapWeakPersistent because the task should not keep this Document alive
3274 ->postTask(BLINK_FROM_HERE, 3270 // just for executing scripts.
3275 m_executeScriptsWaitingForResourcesTask->cancelAndCreate()); 3271 m_executeScriptsWaitingForResourcesTaskHandle =
3272 TaskRunnerHelper::get(TaskType::Networking, this)
3273 ->postCancellableTask(
3274 BLINK_FROM_HERE,
3275 WTF::bind(&Document::executeScriptsWaitingForResources,
3276 wrapWeakPersistent(this)));
3276 3277
3277 if (isHTMLDocument() && body()) { 3278 if (isHTMLDocument() && body()) {
3278 // For HTML if we have no more stylesheets to load and we're past the body 3279 // For HTML if we have no more stylesheets to load and we're past the body
3279 // tag, we should have something to paint so resume. 3280 // tag, we should have something to paint so resume.
3280 beginLifecycleUpdatesIfRenderingReady(); 3281 beginLifecycleUpdatesIfRenderingReady();
3281 } else if (!isHTMLDocument() && documentElement()) { 3282 } else if (!isHTMLDocument() && documentElement()) {
3282 // For non-HTML there is no body so resume as soon as the sheets are loaded. 3283 // For non-HTML there is no body so resume as soon as the sheets are loaded.
3283 beginLifecycleUpdatesIfRenderingReady(); 3284 beginLifecycleUpdatesIfRenderingReady();
3284 } 3285 }
3285 3286
(...skipping 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 } 6445 }
6445 6446
6446 void showLiveDocumentInstances() { 6447 void showLiveDocumentInstances() {
6447 WeakDocumentSet& set = liveDocumentSet(); 6448 WeakDocumentSet& set = liveDocumentSet();
6448 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6449 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6449 for (Document* document : set) 6450 for (Document* document : set)
6450 fprintf(stderr, "- Document %p URL: %s\n", document, 6451 fprintf(stderr, "- Document %p URL: %s\n", document,
6451 document->url().getString().utf8().data()); 6452 document->url().getString().utf8().data());
6452 } 6453 }
6453 #endif 6454 #endif
OLDNEW
« 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