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

Side by Side 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: Rename 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 #include "platform/network/HTTPParsers.h" 205 #include "platform/network/HTTPParsers.h"
206 #include "platform/scroll/ScrollbarTheme.h" 206 #include "platform/scroll/ScrollbarTheme.h"
207 #include "platform/text/PlatformLocale.h" 207 #include "platform/text/PlatformLocale.h"
208 #include "platform/text/SegmentedString.h" 208 #include "platform/text/SegmentedString.h"
209 #include "platform/weborigin/OriginAccessEntry.h" 209 #include "platform/weborigin/OriginAccessEntry.h"
210 #include "platform/weborigin/SchemeRegistry.h" 210 #include "platform/weborigin/SchemeRegistry.h"
211 #include "platform/weborigin/SecurityOrigin.h" 211 #include "platform/weborigin/SecurityOrigin.h"
212 #include "public/platform/Platform.h" 212 #include "public/platform/Platform.h"
213 #include "wtf/CurrentTime.h" 213 #include "wtf/CurrentTime.h"
214 #include "wtf/DateMath.h" 214 #include "wtf/DateMath.h"
215 #include "wtf/Functional.h"
215 #include "wtf/HashFunctions.h" 216 #include "wtf/HashFunctions.h"
216 #include "wtf/MainThread.h" 217 #include "wtf/MainThread.h"
217 #include "wtf/StdLibExtras.h" 218 #include "wtf/StdLibExtras.h"
218 #include "wtf/TemporaryChange.h" 219 #include "wtf/TemporaryChange.h"
219 #include "wtf/text/StringBuffer.h" 220 #include "wtf/text/StringBuffer.h"
220 #include "wtf/text/TextEncodingRegistry.h" 221 #include "wtf/text/TextEncodingRegistry.h"
221 222
222 using namespace WTF; 223 using namespace WTF;
223 using namespace Unicode; 224 using namespace Unicode;
224 225
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 AutofocusTask() { } 356 AutofocusTask() { }
356 void performTask(ExecutionContext* context) override 357 void performTask(ExecutionContext* context) override
357 { 358 {
358 Document* document = toDocument(context); 359 Document* document = toDocument(context);
359 if (RefPtrWillBeRawPtr<Element> element = document->autofocusElement()) { 360 if (RefPtrWillBeRawPtr<Element> element = document->autofocusElement()) {
360 document->setAutofocusElement(0); 361 document->setAutofocusElement(0);
361 element->focus(); 362 element->focus();
362 } 363 }
363 } 364 }
364 }; 365 };
365 366
sof 2015/09/02 13:58:47 Add } // namespace blink namespace WTF { templa
alex clarke (OOO till 29th) 2015/09/02 14:21:41 Done, and thanks!
366 Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC lasses) 367 Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC lasses)
367 : ContainerNode(0, CreateDocument) 368 : ContainerNode(0, CreateDocument)
368 , TreeScope(*this) 369 , TreeScope(*this)
369 , m_hasNodesWithPlaceholderStyle(false) 370 , m_hasNodesWithPlaceholderStyle(false)
370 , m_evaluateMediaQueriesOnStyleRecalc(false) 371 , m_evaluateMediaQueriesOnStyleRecalc(false)
371 , m_shouldProcessFrameLifecycle(false) 372 , m_shouldProcessFrameLifecycle(false)
372 , m_pendingSheetLayout(NoLayoutWithPendingSheets) 373 , m_pendingSheetLayout(NoLayoutWithPendingSheets)
373 , m_frame(initializer.frame()) 374 , m_frame(initializer.frame())
374 , m_domWindow(m_frame ? m_frame->localDOMWindow() : 0) 375 , m_domWindow(m_frame ? m_frame->localDOMWindow() : 0)
375 , m_importsController(initializer.importsController()) 376 , m_importsController(initializer.importsController())
376 , m_activeParserCount(0) 377 , m_activeParserCount(0)
377 , m_contextFeatures(ContextFeatures::defaultSwitch()) 378 , m_contextFeatures(ContextFeatures::defaultSwitch())
378 , m_wellFormed(false) 379 , m_wellFormed(false)
379 , m_printing(false) 380 , m_printing(false)
380 , m_paginatedForScreen(false) 381 , m_paginatedForScreen(false)
381 , m_compatibilityMode(NoQuirksMode) 382 , m_compatibilityMode(NoQuirksMode)
382 , m_compatibilityModeLocked(false) 383 , m_compatibilityModeLocked(false)
383 , m_executeScriptsWaitingForResourcesTimer(this, &Document::executeScriptsWa itingForResourcesTimerFired) 384 , m_executeScriptsWaitingForResourcesTask(WTF::bind(&Document::executeScript sWaitingForResources, this))
384 , m_hasAutofocused(false) 385 , m_hasAutofocused(false)
385 , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired) 386 , m_clearFocusedElementTimer(this, &Document::clearFocusedElementTimerFired)
386 , m_domTreeVersion(++s_globalTreeVersion) 387 , m_domTreeVersion(++s_globalTreeVersion)
387 , m_styleVersion(0) 388 , m_styleVersion(0)
388 , m_listenerTypes(0) 389 , m_listenerTypes(0)
389 , m_mutationObserverTypes(0) 390 , m_mutationObserverTypes(0)
390 , m_visitedLinkState(VisitedLinkState::create(*this)) 391 , m_visitedLinkState(VisitedLinkState::create(*this))
391 , m_visuallyOrdered(false) 392 , m_visuallyOrdered(false)
392 , m_readyState(Complete) 393 , m_readyState(Complete)
393 , m_parsingState(FinishedParsing) 394 , m_parsingState(FinishedParsing)
(...skipping 2555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 // Only imports on master documents can trigger rendering. 2950 // Only imports on master documents can trigger rendering.
2950 if (HTMLImportLoader* import = importLoader()) 2951 if (HTMLImportLoader* import = importLoader())
2951 import->didRemoveAllPendingStylesheet(); 2952 import->didRemoveAllPendingStylesheet();
2952 if (!haveImportsLoaded()) 2953 if (!haveImportsLoaded())
2953 return; 2954 return;
2954 didLoadAllScriptBlockingResources(); 2955 didLoadAllScriptBlockingResources();
2955 } 2956 }
2956 2957
2957 void Document::didLoadAllScriptBlockingResources() 2958 void Document::didLoadAllScriptBlockingResources()
2958 { 2959 {
2959 m_executeScriptsWaitingForResourcesTimer.startOneShot(0, FROM_HERE); 2960 Platform::current()->currentThread()->scheduler()->postLoadingTask(
2961 FROM_HERE, m_executeScriptsWaitingForResourcesTask.cancelAndCreate());
2960 2962
2961 if (frame()) 2963 if (frame())
2962 frame()->loader().client()->didRemoveAllPendingStylesheet(); 2964 frame()->loader().client()->didRemoveAllPendingStylesheet();
2963 2965
2964 if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) 2966 if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
2965 view()->processUrlFragment(m_url); 2967 view()->processUrlFragment(m_url);
2966 } 2968 }
2967 2969
2968 void Document::executeScriptsWaitingForResourcesTimerFired(Timer<Document>*) 2970 void Document::executeScriptsWaitingForResources()
2969 { 2971 {
2970 if (!isRenderingReady()) 2972 if (!isRenderingReady())
2971 return; 2973 return;
2972 if (ScriptableDocumentParser* parser = scriptableDocumentParser()) 2974 if (ScriptableDocumentParser* parser = scriptableDocumentParser())
2973 parser->executeScriptsWaitingForResources(); 2975 parser->executeScriptsWaitingForResources();
2974 } 2976 }
2975 2977
2976 CSSStyleSheet& Document::elementSheet() 2978 CSSStyleSheet& Document::elementSheet()
2977 { 2979 {
2978 if (!m_elemSheet) 2980 if (!m_elemSheet)
(...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after
5718 #ifndef NDEBUG 5720 #ifndef NDEBUG
5719 using namespace blink; 5721 using namespace blink;
5720 void showLiveDocumentInstances() 5722 void showLiveDocumentInstances()
5721 { 5723 {
5722 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5724 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5723 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5725 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5724 for (Document* document : set) 5726 for (Document* document : set)
5725 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5727 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5726 } 5728 }
5727 #endif 5729 #endif
OLDNEW
« 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