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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 673603002: Reland: Make the HTMLDocumentParser yield more aggressively (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 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 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "core/dom/DocumentLifecycleObserver.h" 70 #include "core/dom/DocumentLifecycleObserver.h"
71 #include "core/dom/DocumentMarkerController.h" 71 #include "core/dom/DocumentMarkerController.h"
72 #include "core/dom/DocumentType.h" 72 #include "core/dom/DocumentType.h"
73 #include "core/dom/Element.h" 73 #include "core/dom/Element.h"
74 #include "core/dom/ElementDataCache.h" 74 #include "core/dom/ElementDataCache.h"
75 #include "core/dom/ElementRegistrationOptions.h" 75 #include "core/dom/ElementRegistrationOptions.h"
76 #include "core/dom/ElementTraversal.h" 76 #include "core/dom/ElementTraversal.h"
77 #include "core/dom/ExceptionCode.h" 77 #include "core/dom/ExceptionCode.h"
78 #include "core/dom/ExecutionContextTask.h" 78 #include "core/dom/ExecutionContextTask.h"
79 #include "core/dom/MainThreadTaskRunner.h" 79 #include "core/dom/MainThreadTaskRunner.h"
80 #include "core/dom/Microtask.h"
80 #include "core/dom/MutationObserver.h" 81 #include "core/dom/MutationObserver.h"
81 #include "core/dom/NodeChildRemovalTracker.h" 82 #include "core/dom/NodeChildRemovalTracker.h"
82 #include "core/dom/NodeFilter.h" 83 #include "core/dom/NodeFilter.h"
83 #include "core/dom/NodeIterator.h" 84 #include "core/dom/NodeIterator.h"
84 #include "core/dom/NodeRareData.h" 85 #include "core/dom/NodeRareData.h"
85 #include "core/dom/NodeRenderStyle.h" 86 #include "core/dom/NodeRenderStyle.h"
86 #include "core/dom/NodeRenderingTraversal.h" 87 #include "core/dom/NodeRenderingTraversal.h"
87 #include "core/dom/NodeTraversal.h" 88 #include "core/dom/NodeTraversal.h"
88 #include "core/dom/NodeWithIndex.h" 89 #include "core/dom/NodeWithIndex.h"
89 #include "core/dom/ProcessingInstruction.h" 90 #include "core/dom/ProcessingInstruction.h"
(...skipping 4537 matching lines...) Expand 10 before | Expand all | Expand 10 after
4627 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); 4628 ASSERT(!scriptableDocumentParser() || !m_parser->isParsing());
4628 ASSERT(!scriptableDocumentParser() || m_readyState != Loading); 4629 ASSERT(!scriptableDocumentParser() || m_readyState != Loading);
4629 setParsingState(InDOMContentLoaded); 4630 setParsingState(InDOMContentLoaded);
4630 if (!m_documentTiming.domContentLoadedEventStart) 4631 if (!m_documentTiming.domContentLoadedEventStart)
4631 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e(); 4632 m_documentTiming.domContentLoadedEventStart = monotonicallyIncreasingTim e();
4632 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); 4633 dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded));
4633 if (!m_documentTiming.domContentLoadedEventEnd) 4634 if (!m_documentTiming.domContentLoadedEventEnd)
4634 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( ); 4635 m_documentTiming.domContentLoadedEventEnd = monotonicallyIncreasingTime( );
4635 setParsingState(FinishedParsing); 4636 setParsingState(FinishedParsing);
4636 4637
4638 Microtask::performCheckpoint();
4639
4637 // The loader's finishedParsing() method may invoke script that causes this object to 4640 // The loader's finishedParsing() method may invoke script that causes this object to
4638 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change). 4641 // be dereferenced (when this document is in an iframe and the onload causes the iframe's src to change).
4639 // Keep it alive until we are done. 4642 // Keep it alive until we are done.
4640 RefPtrWillBeRawPtr<Document> protect(this); 4643 RefPtrWillBeRawPtr<Document> protect(this);
4641 4644
4642 if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) { 4645 if (RefPtrWillBeRawPtr<LocalFrame> frame = this->frame()) {
4643 // Don't update the render tree if we haven't requested the main resourc e yet to avoid 4646 // Don't update the render tree if we haven't requested the main resourc e yet to avoid
4644 // adding extra latency. Note that the first render tree update can be e xpensive since it 4647 // adding extra latency. Note that the first render tree update can be e xpensive since it
4645 // triggers the parsing of the default stylesheets which are compiled-in . 4648 // triggers the parsing of the default stylesheets which are compiled-in .
4646 const bool mainResourceWasAlreadyRequested = frame->loader().stateMachin e()->committedFirstRealDocumentLoad(); 4649 const bool mainResourceWasAlreadyRequested = frame->loader().stateMachin e()->committedFirstRealDocumentLoad();
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
5851 #ifndef NDEBUG 5854 #ifndef NDEBUG
5852 using namespace blink; 5855 using namespace blink;
5853 void showLiveDocumentInstances() 5856 void showLiveDocumentInstances()
5854 { 5857 {
5855 WeakDocumentSet& set = liveDocumentSet(); 5858 WeakDocumentSet& set = liveDocumentSet();
5856 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5859 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5857 for (Document* document : set) 5860 for (Document* document : set)
5858 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5861 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5859 } 5862 }
5860 #endif 5863 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698