<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162258] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162258">162258</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-01-18 10:25:30 -0800 (Sat, 18 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove the remaining threaded parser code
https://bugs.webkit.org/show_bug.cgi?id=127224
Reviewed by Andreas Kling.
* dom/Document.cpp:
(WebCore::Document::decrementActiveParserCount):
* html/parser/AtomicHTMLToken.h:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::HTMLDocumentParser):
(WebCore::HTMLDocumentParser::detach):
(WebCore::HTMLDocumentParser::stopParsing):
(WebCore::HTMLDocumentParser::prepareToStopParsing):
(WebCore::HTMLDocumentParser::resumeParsingAfterYield):
(WebCore::HTMLDocumentParser::forcePlaintextForTextDocument):
(WebCore::HTMLDocumentParser::insert):
(WebCore::HTMLDocumentParser::append):
(WebCore::HTMLDocumentParser::end):
(WebCore::HTMLDocumentParser::finish):
(WebCore::HTMLDocumentParser::textPosition):
(WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution):
* html/parser/HTMLDocumentParser.h:
* html/parser/HTMLParserIdioms.cpp:
* html/parser/HTMLParserIdioms.h:
* html/parser/HTMLTokenizer.cpp:
* html/parser/HTMLTokenizer.h:
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::isLoading):
(WebCore::DocumentLoader::checkLoadComplete):
* page/Settings.in:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserAtomicHTMLTokenh">trunk/Source/WebCore/html/parser/AtomicHTMLToken.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLDocumentParsercpp">trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLDocumentParserh">trunk/Source/WebCore/html/parser/HTMLDocumentParser.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLParserIdiomscpp">trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLParserIdiomsh">trunk/Source/WebCore/html/parser/HTMLParserIdioms.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTokenizercpp">trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLTokenizerh">trunk/Source/WebCore/html/parser/HTMLTokenizer.h</a></li>
<li><a href="#trunkSourceWebCoreloaderDocumentLoadercpp">trunk/Source/WebCore/loader/DocumentLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSettingsin">trunk/Source/WebCore/page/Settings.in</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/ChangeLog        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -1,5 +1,38 @@
</span><span class="cx"> 2014-01-18 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><ins>+ Remove the remaining threaded parser code
+ https://bugs.webkit.org/show_bug.cgi?id=127224
+
+ Reviewed by Andreas Kling.
+
+ * dom/Document.cpp:
+ (WebCore::Document::decrementActiveParserCount):
+ * html/parser/AtomicHTMLToken.h:
+ * html/parser/HTMLDocumentParser.cpp:
+ (WebCore::HTMLDocumentParser::HTMLDocumentParser):
+ (WebCore::HTMLDocumentParser::detach):
+ (WebCore::HTMLDocumentParser::stopParsing):
+ (WebCore::HTMLDocumentParser::prepareToStopParsing):
+ (WebCore::HTMLDocumentParser::resumeParsingAfterYield):
+ (WebCore::HTMLDocumentParser::forcePlaintextForTextDocument):
+ (WebCore::HTMLDocumentParser::insert):
+ (WebCore::HTMLDocumentParser::append):
+ (WebCore::HTMLDocumentParser::end):
+ (WebCore::HTMLDocumentParser::finish):
+ (WebCore::HTMLDocumentParser::textPosition):
+ (WebCore::HTMLDocumentParser::resumeParsingAfterScriptExecution):
+ * html/parser/HTMLDocumentParser.h:
+ * html/parser/HTMLParserIdioms.cpp:
+ * html/parser/HTMLParserIdioms.h:
+ * html/parser/HTMLTokenizer.cpp:
+ * html/parser/HTMLTokenizer.h:
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::isLoading):
+ (WebCore::DocumentLoader::checkLoadComplete):
+ * page/Settings.in:
+
+2014-01-18 Anders Carlsson <andersca@apple.com>
+
</ins><span class="cx"> Remove threaded parser code from the preload scanners
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=127222
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -5853,12 +5853,10 @@
</span><span class="cx"> --m_activeParserCount;
</span><span class="cx"> if (!frame())
</span><span class="cx"> return;
</span><del>- // FIXME: This should always be enabled, but it seems to cause
- // http/tests/security/feed-urls-from-remote.html to timeout on Mac WK1
- // see http://webkit.org/b/110554 and http://webkit.org/b/110401
-#if ENABLE(THREADED_HTML_PARSER)
- loader()->checkLoadComplete();
-#endif
</del><ins>+
+ // FIXME: We should call loader()->checkLoadComplete() as well here,
+ // but it seems to cause http/tests/security/feed-urls-from-remote.html
+ // to timeout on Mac WK1; see http://webkit.org/b/110554 and http://webkit.org/b/110401.
</ins><span class="cx"> frame()->loader().checkLoadComplete();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserAtomicHTMLTokenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/AtomicHTMLToken.h (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/AtomicHTMLToken.h        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/AtomicHTMLToken.h        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -152,59 +152,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-
- explicit AtomicHTMLToken(const CompactHTMLToken& token)
- : m_type(token.type())
- {
- switch (m_type) {
- case HTMLToken::Uninitialized:
- ASSERT_NOT_REACHED();
- break;
- case HTMLToken::DOCTYPE:
- m_name = token.data().asString();
- m_doctypeData = adoptPtr(new DoctypeData());
- m_doctypeData->m_hasPublicIdentifier = true;
- append(m_doctypeData->m_publicIdentifier, token.publicIdentifier().asString());
- m_doctypeData->m_hasSystemIdentifier = true;
- append(m_doctypeData->m_systemIdentifier, token.systemIdentifier());
- m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks();
- break;
- case HTMLToken::EndOfFile:
- break;
- case HTMLToken::StartTag:
- m_attributes.reserveInitialCapacity(token.attributes().size());
- for (Vector<CompactHTMLToken::Attribute>::const_iterator it = token.attributes().begin(); it != token.attributes().end(); ++it) {
- QualifiedName name(nullAtom, it->name.asString(), nullAtom);
- // FIXME: This is N^2 for the number of attributes.
- if (!findAttributeInVector(m_attributes, name))
- m_attributes.append(Attribute(name, it->value));
- }
- // Fall through!
- case HTMLToken::EndTag:
- m_selfClosing = token.selfClosing();
- m_name = token.data().asString();
- break;
- case HTMLToken::Comment:
- m_data = token.data().asString();
- break;
- case HTMLToken::Character: {
- const String& string = token.data().asString();
- m_externalCharacters = string.characters();
- m_externalCharactersLength = string.length();
- m_isAll8BitData = token.isAll8BitData();
- // FIXME: We would like a stronger ASSERT here:
- // ASSERT(string.is8Bit() == token.isAll8BitData());
- // but currently that fires, likely due to bugs in HTMLTokenizer
- // not setting isAll8BitData in all the times it could.
- ASSERT(!token.isAll8BitData() || string.is8Bit());
- break;
- }
- }
- }
-
-#endif
-
</del><span class="cx"> explicit AtomicHTMLToken(HTMLToken::Type type)
</span><span class="cx"> : m_type(type)
</span><span class="cx"> , m_externalCharacters(0)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLDocumentParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -76,9 +76,6 @@
</span><span class="cx"> , m_treeBuilder(HTMLTreeBuilder::create(*this, document, parserContentPolicy(), m_options))
</span><span class="cx"> , m_parserScheduler(HTMLParserScheduler::create(*this))
</span><span class="cx"> , m_xssAuditorDelegate(document)
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- , m_weakFactory(this)
-#endif
</del><span class="cx"> , m_preloader(adoptPtr(new HTMLResourcePreloader(document)))
</span><span class="cx"> , m_endWasDelayed(false)
</span><span class="cx"> , m_haveBackgroundParser(false)
</span><span class="lines">@@ -97,9 +94,6 @@
</span><span class="cx"> , m_tokenizer(HTMLTokenizer::create(m_options))
</span><span class="cx"> , m_treeBuilder(HTMLTreeBuilder::create(*this, fragment, contextElement, this->parserContentPolicy(), m_options))
</span><span class="cx"> , m_xssAuditorDelegate(fragment.document())
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- , m_weakFactory(this)
-#endif
</del><span class="cx"> , m_endWasDelayed(false)
</span><span class="cx"> , m_haveBackgroundParser(false)
</span><span class="cx"> , m_pumpSessionNestingLevel(0)
</span><span class="lines">@@ -120,11 +114,8 @@
</span><span class="cx">
</span><span class="cx"> void HTMLDocumentParser::detach()
</span><span class="cx"> {
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_haveBackgroundParser)
- stopBackgroundParser();
-#endif
</del><span class="cx"> DocumentParser::detach();
</span><ins>+
</ins><span class="cx"> if (m_scriptRunner)
</span><span class="cx"> m_scriptRunner->detach();
</span><span class="cx"> m_treeBuilder->detach();
</span><span class="lines">@@ -139,10 +130,6 @@
</span><span class="cx"> {
</span><span class="cx"> DocumentParser::stopParsing();
</span><span class="cx"> m_parserScheduler.clear(); // Deleting the scheduler will clear any timers.
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_haveBackgroundParser)
- stopBackgroundParser();
-#endif
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This kicks off "Once the user agent stops parsing" as described by:
</span><span class="lines">@@ -159,14 +146,7 @@
</span><span class="cx">
</span><span class="cx"> // NOTE: This pump should only ever emit buffered character tokens,
</span><span class="cx"> // so ForceSynchronous vs. AllowYield should be meaningless.
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_tokenizer) {
- ASSERT(!m_haveBackgroundParser);
- pumpTokenizerIfPossible(ForceSynchronous);
- }
-#else
</del><span class="cx"> pumpTokenizerIfPossible(ForceSynchronous);
</span><del>-#endif
</del><span class="cx">
</span><span class="cx"> if (isStopped())
</span><span class="cx"> return;
</span><span class="lines">@@ -221,13 +201,6 @@
</span><span class="cx"> // but we need to ensure it isn't deleted yet.
</span><span class="cx"> Ref<HTMLDocumentParser> protect(*this);
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_haveBackgroundParser) {
- pumpPendingSpeculations();
- return;
- }
-#endif
-
</del><span class="cx"> // We should never be here unless we can pump immediately. Call pumpTokenizer()
</span><span class="cx"> // directly so that ASSERTS will fire if we're wrong.
</span><span class="cx"> pumpTokenizer(AllowYield);
</span><span class="lines">@@ -282,198 +255,9 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-
-void HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser(OwnPtr<ParsedChunk> chunk)
-{
- if (isWaitingForScripts() || !m_speculations.isEmpty()) {
- m_preloader->takeAndPreload(chunk->preloads);
- m_speculations.append(chunk);
- return;
- }
-
- // processParsedChunkFromBackgroundParser can cause this parser to be detached from the Document,
- // but we need to ensure it isn't deleted yet.
- Ref<HTMLDocumentParser> protect(*this);
-
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), textPosition().m_line.zeroBasedInt());
-
- ASSERT(m_speculations.isEmpty());
- chunk->preloads.clear(); // We don't need to preload because we're going to parse immediately.
- processParsedChunkFromBackgroundParser(chunk);
-
- InspectorInstrumentation::didWriteHTML(cookie, textPosition().m_line.zeroBasedInt());
-}
-
-void HTMLDocumentParser::validateSpeculations(OwnPtr<ParsedChunk> chunk)
-{
- ASSERT(chunk);
- if (isWaitingForScripts()) {
- // We're waiting on a network script, just save the chunk, we'll get
- // a second validateSpeculations call after the script completes.
- // This call should have been made immediately after runScriptsForPausedTreeBuilder
- // which may have started a network load and left us waiting.
- ASSERT(!m_lastChunkBeforeScript);
- m_lastChunkBeforeScript = chunk;
- return;
- }
-
- ASSERT(!m_lastChunkBeforeScript);
- OwnPtr<HTMLTokenizer> tokenizer = m_tokenizer.release();
- OwnPtr<HTMLToken> token = m_token.release();
-
- if (!tokenizer) {
- // There must not have been any changes to the HTMLTokenizer state on
- // the main thread, which means the speculation buffer is correct.
- return;
- }
-
- // Currently we're only smart enough to reuse the speculation buffer if the tokenizer
- // both starts and ends in the DataState. That state is simplest because the HTMLToken
- // is always in the Uninitialized state. We should consider whether we can reuse the
- // speculation buffer in other states, but we'd likely need to do something more
- // sophisticated with the HTMLToken.
- if (chunk->tokenizerState == HTMLTokenizer::DataState
- && tokenizer->state() == HTMLTokenizer::DataState
- && m_input.current().isEmpty()
- && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeBuilder.get())) {
- ASSERT(token->isUninitialized());
- return;
- }
-
- discardSpeculationsAndResumeFrom(chunk, token.release(), tokenizer.release());
-}
-
-void HTMLDocumentParser::discardSpeculationsAndResumeFrom(OwnPtr<ParsedChunk> lastChunkBeforeScript, OwnPtr<HTMLToken> token, OwnPtr<HTMLTokenizer> tokenizer)
-{
- m_weakFactory.revokeAll();
- m_speculations.clear();
-
- OwnPtr<BackgroundHTMLParser::Checkpoint> checkpoint = adoptPtr(new BackgroundHTMLParser::Checkpoint);
- checkpoint->parser = m_weakFactory.createWeakPtr();
- checkpoint->token = token;
- checkpoint->tokenizer = tokenizer;
- checkpoint->treeBuilderState = HTMLTreeBuilderSimulator::stateFor(m_treeBuilder.get());
- checkpoint->inputCheckpoint = lastChunkBeforeScript->inputCheckpoint;
- checkpoint->preloadScannerCheckpoint = lastChunkBeforeScript->preloadScannerCheckpoint;
- checkpoint->unparsedInput = m_input.current().toString().isolatedCopy();
- m_input.current().clear(); // FIXME: This should be passed in instead of cleared.
-
- ASSERT(checkpoint->unparsedInput.isSafeToSendToAnotherThread());
- HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::resumeFrom, m_backgroundParser, checkpoint.release()));
-}
-
-void HTMLDocumentParser::processParsedChunkFromBackgroundParser(OwnPtr<ParsedChunk> popChunk)
-{
- // ASSERT that this object is both attached to the Document and protected.
- ASSERT(refCount() >= 2);
- ASSERT(shouldUseThreading());
- ASSERT(!m_tokenizer);
- ASSERT(!m_token);
- ASSERT(!m_lastChunkBeforeScript);
-
- ActiveParserSession session(contextForParsingSession());
- OwnPtr<ParsedChunk> chunk(popChunk);
- OwnPtr<CompactHTMLTokenStream> tokens = chunk->tokens.release();
-
- HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::startedChunkWithCheckpoint, m_backgroundParser, chunk->inputCheckpoint));
-
- for (XSSInfoStream::const_iterator it = chunk->xssInfos.begin(); it != chunk->xssInfos.end(); ++it) {
- m_textPosition = (*it)->m_textPosition;
- m_xssAuditorDelegate.didBlockScript(**it);
- if (isStopped())
- break;
- }
-
- for (Vector<CompactHTMLToken>::const_iterator it = tokens->begin(); it != tokens->end(); ++it) {
- ASSERT(!isWaitingForScripts());
-
- if (!isParsingFragment()
- && document()->frame() && document()->frame()->navigationScheduler().locationChangePending()) {
-
- // To match main-thread parser behavior (which never checks locationChangePending on the EOF path)
- // we peek to see if this chunk has an EOF and process it anyway.
- if (tokens->last().type() == HTMLToken::EndOfFile) {
- ASSERT(m_speculations.isEmpty());
- prepareToStopParsing();
- }
- break;
- }
-
- m_textPosition = it->textPosition();
-
- constructTreeFromCompactHTMLToken(*it);
-
- if (isStopped())
- break;
-
- if (isWaitingForScripts()) {
- ASSERT(it + 1 == tokens->end()); // The </script> is assumed to be the last token of this bunch.
- runScriptsForPausedTreeBuilder();
- validateSpeculations(chunk.release());
- break;
- }
-
- if (it->type() == HTMLToken::EndOfFile) {
- ASSERT(it + 1 == tokens->end()); // The EOF is assumed to be the last token of this bunch.
- ASSERT(m_speculations.isEmpty());
- prepareToStopParsing();
- break;
- }
-
- ASSERT(!m_tokenizer);
- ASSERT(!m_token);
- }
-}
-
-void HTMLDocumentParser::pumpPendingSpeculations()
-{
- // FIXME: Share this constant with the parser scheduler.
- const double parserTimeLimit = 0.500;
-
- // ASSERT that this object is both attached to the Document and protected.
- ASSERT(refCount() >= 2);
- // If this assert fails, you need to call validateSpeculations to make sure
- // m_tokenizer and m_token don't have state that invalidates m_speculations.
- ASSERT(!m_tokenizer);
- ASSERT(!m_token);
- ASSERT(!m_lastChunkBeforeScript);
-
- // FIXME: Pass in current input length.
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), textPosition().m_line.zeroBasedInt());
-
- double startTime = monotonicallyIncreasingTime();
-
- while (!m_speculations.isEmpty()) {
- processParsedChunkFromBackgroundParser(m_speculations.takeFirst());
-
- if (isWaitingForScripts() || isStopped())
- break;
-
- if (monotonicallyIncreasingTime() - startTime > parserTimeLimit && !m_speculations.isEmpty()) {
- m_parserScheduler->scheduleForResume();
- break;
- }
- }
-
- InspectorInstrumentation::didWriteHTML(cookie, textPosition().m_line.zeroBasedInt());
-}
-
-#endif // ENABLE(THREADED_HTML_PARSER)
-
</del><span class="cx"> void HTMLDocumentParser::forcePlaintextForTextDocument()
</span><span class="cx"> {
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (shouldUseThreading()) {
- // This method is called before any data is appended, so we have to start
- // the background parser ourselves.
- if (!m_haveBackgroundParser)
- startBackgroundParser();
-
- HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::forcePlaintextForTextDocument, m_backgroundParser));
- } else
-#endif
- m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
</del><ins>+ m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Document* HTMLDocumentParser::contextForParsingSession()
</span><span class="lines">@@ -573,16 +357,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-
-void HTMLDocumentParser::constructTreeFromCompactHTMLToken(const CompactHTMLToken& compactToken)
-{
- AtomicHTMLToken token(compactToken);
- m_treeBuilder->constructTree(&token);
-}
-
-#endif
-
</del><span class="cx"> bool HTMLDocumentParser::hasInsertionPoint()
</span><span class="cx"> {
</span><span class="cx"> // FIXME: The wasCreatedByScript() branch here might not be fully correct.
</span><span class="lines">@@ -602,15 +376,6 @@
</span><span class="cx"> // but we need to ensure it isn't deleted yet.
</span><span class="cx"> Ref<HTMLDocumentParser> protect(*this);
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (!m_tokenizer) {
- ASSERT(!inPumpSession());
- ASSERT(m_haveBackgroundParser || wasCreatedByScript());
- m_token = adoptPtr(new HTMLToken);
- m_tokenizer = HTMLTokenizer::create(m_options);
- }
-#endif
-
</del><span class="cx"> SegmentedString excludedLineNumberSource(source);
</span><span class="cx"> excludedLineNumberSource.setExcludeLineNumbers();
</span><span class="cx"> m_input.insertAtCurrentInsertionPoint(excludedLineNumberSource);
</span><span class="lines">@@ -629,63 +394,11 @@
</span><span class="cx"> endIfDelayed();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-
-void HTMLDocumentParser::startBackgroundParser()
-{
- ASSERT(shouldUseThreading());
- ASSERT(!m_haveBackgroundParser);
- m_haveBackgroundParser = true;
-
- HTMLIdentifier::init();
-
- RefPtr<WeakReference<BackgroundHTMLParser>> reference = WeakReference<BackgroundHTMLParser>::createUnbound();
- m_backgroundParser = WeakPtr<BackgroundHTMLParser>(reference);
-
- OwnPtr<BackgroundHTMLParser::Configuration> config = adoptPtr(new BackgroundHTMLParser::Configuration);
- config->options = m_options;
- config->parser = m_weakFactory.createWeakPtr();
- config->xssAuditor = adoptPtr(new XSSAuditor);
- config->xssAuditor->init(document(), &m_xssAuditorDelegate);
- config->preloadScanner = adoptPtr(new TokenPreloadScanner(document()->url().copy()));
-
- ASSERT(config->xssAuditor->isSafeToSendToAnotherThread());
- ASSERT(config->preloadScanner->isSafeToSendToAnotherThread());
- HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::create, reference.release(), config.release()));
-}
-
-void HTMLDocumentParser::stopBackgroundParser()
-{
- ASSERT(shouldUseThreading());
- ASSERT(m_haveBackgroundParser);
- m_haveBackgroundParser = false;
-
- HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::stop, m_backgroundParser));
- m_weakFactory.revokeAll();
-}
-
-#endif
-
</del><span class="cx"> void HTMLDocumentParser::append(PassRefPtr<StringImpl> inputSource)
</span><span class="cx"> {
</span><span class="cx"> if (isStopped())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (shouldUseThreading()) {
- if (!m_haveBackgroundParser)
- startBackgroundParser();
-
- ASSERT(inputSource->hasOneRef());
- Closure closure = bind(&BackgroundHTMLParser::append, m_backgroundParser, String(inputSource));
- // NOTE: Important that the String temporary is destroyed before we post the task
- // otherwise the String could call deref() on a StringImpl now owned by the background parser.
- // We would like to ASSERT(closure.arg3()->hasOneRef()) but sadly the args are private.
- HTMLParserThread::shared()->postTask(closure);
- return;
- }
-#endif
-
</del><span class="cx"> // pumpTokenizer can cause this parser to be detached from the Document,
</span><span class="cx"> // but we need to ensure it isn't deleted yet.
</span><span class="cx"> Ref<HTMLDocumentParser> protect(*this);
</span><span class="lines">@@ -722,11 +435,6 @@
</span><span class="cx"> ASSERT(!isDetached());
</span><span class="cx"> ASSERT(!isScheduledForResume());
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_haveBackgroundParser)
- stopBackgroundParser();
-#endif
-
</del><span class="cx"> // Informs the the rest of WebCore that parsing is really finished (and deletes this).
</span><span class="cx"> m_treeBuilder->finished();
</span><span class="cx"> }
</span><span class="lines">@@ -773,27 +481,6 @@
</span><span class="cx"> // makes sense to call any methods on DocumentParser once it's been stopped.
</span><span class="cx"> // However, FrameLoader::stop calls DocumentParser::finish unconditionally.
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- // Empty documents never got an append() call, and thus have never started
- // a background parser. In those cases, we ignore shouldUseThreading()
- // and fall through to the non-threading case.
- if (m_haveBackgroundParser) {
- if (!m_input.haveSeenEndOfFile())
- m_input.closeWithoutMarkingEndOfFile();
- HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::finish, m_backgroundParser));
- return;
- }
-
- if (!m_tokenizer) {
- ASSERT(!m_token);
- // We're finishing before receiving any data. Rather than booting up
- // the background parser just to spin it down, we finish parsing
- // synchronously.
- m_token = adoptPtr(new HTMLToken);
- m_tokenizer = HTMLTokenizer::create(m_options);
- }
-#endif
-
</del><span class="cx"> // We're not going to get any more data off the network, so we tell the
</span><span class="cx"> // input stream we've reached the end of file. finish() can be called more
</span><span class="cx"> // than once, if the first time does not call end().
</span><span class="lines">@@ -812,11 +499,6 @@
</span><span class="cx">
</span><span class="cx"> TextPosition HTMLDocumentParser::textPosition() const
</span><span class="cx"> {
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_haveBackgroundParser)
- return m_textPosition;
-#endif
-
</del><span class="cx"> const SegmentedString& currentString = m_input.current();
</span><span class="cx"> OrdinalNumber line = currentString.currentLine();
</span><span class="cx"> OrdinalNumber column = currentString.currentColumn();
</span><span class="lines">@@ -845,18 +527,6 @@
</span><span class="cx"> ASSERT(!isExecutingScript());
</span><span class="cx"> ASSERT(!isWaitingForScripts());
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (m_haveBackgroundParser) {
- validateSpeculations(m_lastChunkBeforeScript.release());
- ASSERT(!m_lastChunkBeforeScript);
- // processParsedChunkFromBackgroundParser can cause this parser to be detached from the Document,
- // but we need to ensure it isn't deleted yet.
- Ref<HTMLDocumentParser> protect(*this);
- pumpPendingSpeculations();
- return;
- }
-#endif
-
</del><span class="cx"> m_insertionPreloadScanner.clear();
</span><span class="cx"> pumpTokenizerIfPossible(AllowYield);
</span><span class="cx"> endIfDelayed();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLDocumentParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.h (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.h        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.h        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -81,19 +81,6 @@
</span><span class="cx"> virtual void suspendScheduledTasks() override;
</span><span class="cx"> virtual void resumeScheduledTasks() override;
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- struct ParsedChunk {
- OwnPtr<CompactHTMLTokenStream> tokens;
- PreloadRequestStream preloads;
- XSSInfoStream xssInfos;
- HTMLTokenizer::State tokenizerState;
- HTMLTreeBuilderSimulator::State treeBuilderState;
- HTMLInputCheckpoint inputCheckpoint;
- TokenPreloadScannerCheckpoint preloadScannerCheckpoint;
- };
- void didReceiveParsedChunkFromBackgroundParser(OwnPtr<ParsedChunk>);
-#endif
-
</del><span class="cx"> protected:
</span><span class="cx"> virtual void insert(const SegmentedString&) override;
</span><span class="cx"> virtual void append(PassRefPtr<StringImpl>) override;
</span><span class="lines">@@ -132,15 +119,6 @@
</span><span class="cx"> // CachedResourceClient
</span><span class="cx"> virtual void notifyFinished(CachedResource*) override;
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- void startBackgroundParser();
- void stopBackgroundParser();
- void validateSpeculations(OwnPtr<ParsedChunk> lastChunk);
- void discardSpeculationsAndResumeFrom(OwnPtr<ParsedChunk> lastChunk, OwnPtr<HTMLToken>, OwnPtr<HTMLTokenizer>);
- void processParsedChunkFromBackgroundParser(OwnPtr<ParsedChunk>);
- void pumpPendingSpeculations();
-#endif
-
</del><span class="cx"> Document* contextForParsingSession();
</span><span class="cx">
</span><span class="cx"> enum SynchronousMode {
</span><span class="lines">@@ -151,9 +129,6 @@
</span><span class="cx"> void pumpTokenizer(SynchronousMode);
</span><span class="cx"> void pumpTokenizerIfPossible(SynchronousMode);
</span><span class="cx"> void constructTreeFromHTMLToken(HTMLToken&);
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- void constructTreeFromCompactHTMLToken(const CompactHTMLToken&);
-#endif
</del><span class="cx">
</span><span class="cx"> void runScriptsForPausedTreeBuilder();
</span><span class="cx"> void resumeParsingAfterScriptExecution();
</span><span class="lines">@@ -185,14 +160,6 @@
</span><span class="cx"> XSSAuditor m_xssAuditor;
</span><span class="cx"> XSSAuditorDelegate m_xssAuditorDelegate;
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- // FIXME: m_lastChunkBeforeScript, m_tokenizer, m_token, and m_input should be combined into a single state object
- // so they can be set and cleared together and passed between threads together.
- OwnPtr<ParsedChunk> m_lastChunkBeforeScript;
- Deque<OwnPtr<ParsedChunk>> m_speculations;
- WeakPtrFactory<HTMLDocumentParser> m_weakFactory;
- WeakPtr<BackgroundHTMLParser> m_backgroundParser;
-#endif
</del><span class="cx"> OwnPtr<HTMLResourcePreloader> m_preloader;
</span><span class="cx">
</span><span class="cx"> bool m_endWasDelayed;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLParserIdiomscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -290,13 +290,6 @@
</span><span class="cx"> return threadSafeEqual(a.localName().impl(), b.localName().impl());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-bool threadSafeMatch(const HTMLIdentifier& localName, const QualifiedName& qName)
-{
- return threadSafeEqual(localName.asStringImpl(), qName.localName().impl());
-}
-#endif
-
</del><span class="cx"> struct ImageWithScale {
</span><span class="cx"> unsigned imageURLStart;
</span><span class="cx"> unsigned imageURLLength;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLParserIdiomsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -98,16 +98,6 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool threadSafeMatch(const QualifiedName&, const QualifiedName&);
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-bool threadSafeMatch(const HTMLIdentifier&, const QualifiedName&);
-inline bool threadSafeHTMLNamesMatch(const HTMLIdentifier& tagName, const QualifiedName& qName)
-{
- // When the QualifiedName is known to HTMLIdentifier,
- // all we have to do is a pointer compare.
- ASSERT(HTMLIdentifier::hasIndex(qName.localName().impl()));
- return tagName.asStringImpl() == qName.localName().impl();
-}
-#endif
</del><span class="cx">
</span><span class="cx"> String bestFitSourceForImageAttributes(float deviceScaleFactor, const String& srcAttribute, const String& sourceSetAttribute);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTokenizercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/HTMLTokenizer.cpp        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -120,41 +120,6 @@
</span><span class="cx"> m_additionalAllowedCharacter = '\0';
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-
-bool HTMLTokenizer::canCreateCheckpoint() const
-{
- if (!m_appropriateEndTagName.isEmpty())
- return false;
- if (!m_temporaryBuffer.isEmpty())
- return false;
- if (!m_bufferedEndTagName.isEmpty())
- return false;
- return true;
-}
-
-void HTMLTokenizer::createCheckpoint(Checkpoint& result) const
-{
- ASSERT(canCreateCheckpoint());
- result.options = m_options;
- result.state = m_state;
- result.additionalAllowedCharacter = m_additionalAllowedCharacter;
- result.skipNextNewLine = m_inputStreamPreprocessor.skipNextNewLine();
- result.shouldAllowCDATA = m_shouldAllowCDATA;
-}
-
-void HTMLTokenizer::restoreFromCheckpoint(const Checkpoint& checkpoint)
-{
- m_token = 0;
- m_options = checkpoint.options;
- m_state = checkpoint.state;
- m_additionalAllowedCharacter = checkpoint.additionalAllowedCharacter;
- m_inputStreamPreprocessor.reset(checkpoint.skipNextNewLine);
- m_shouldAllowCDATA = checkpoint.shouldAllowCDATA;
-}
-
-#endif
-
</del><span class="cx"> inline bool HTMLTokenizer::processEntity(SegmentedString& source)
</span><span class="cx"> {
</span><span class="cx"> bool notEnoughCharacters = false;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLTokenizerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLTokenizer.h (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLTokenizer.h        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/html/parser/HTMLTokenizer.h        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -121,33 +121,6 @@
</span><span class="cx"> CDATASectionDoubleRightSquareBracketState,
</span><span class="cx"> };
</span><span class="cx">
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
-
- struct Checkpoint {
- HTMLParserOptions options;
- State state;
- UChar additionalAllowedCharacter;
- bool skipNextNewLine;
- bool forceNullCharacterReplacement;
- bool shouldAllowCDATA;
-
- Checkpoint()
- : options(0)
- , state()
- , additionalAllowedCharacter('\0')
- , skipNextNewLine(false)
- , forceNullCharacterReplacement(false)
- , shouldAllowCDATA(false)
- {
- }
- };
-
- bool canCreateCheckpoint() const;
- void createCheckpoint(Checkpoint&) const;
- void restoreFromCheckpoint(const Checkpoint&);
-
-#endif
-
</del><span class="cx"> // This function returns true if it emits a token. Otherwise, callers
</span><span class="cx"> // must provide the same (in progress) token on the next call (unless
</span><span class="cx"> // they call reset() first).
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderDocumentLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -357,13 +357,12 @@
</span><span class="cx">
</span><span class="cx"> bool DocumentLoader::isLoading() const
</span><span class="cx"> {
</span><del>- // FIXME: This should always be enabled, but it seems to cause
</del><ins>+ // if (document() && document()->hasActiveParser())
+ // return true;
+ // FIXME: The above code should be enabled, but it seems to cause
</ins><span class="cx"> // http/tests/security/feed-urls-from-remote.html to timeout on Mac WK1
</span><span class="cx"> // see http://webkit.org/b/110554 and http://webkit.org/b/110401
</span><del>-#if ENABLE(THREADED_HTML_PARSER)
- if (document() && document()->hasActiveParser())
- return true;
-#endif
</del><ins>+
</ins><span class="cx"> return isLoadingMainResource() || !m_subresourceLoaders.isEmpty() || !m_plugInStreamLoaders.isEmpty();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -920,11 +919,8 @@
</span><span class="cx"> {
</span><span class="cx"> if (!m_frame || isLoading())
</span><span class="cx"> return;
</span><del>-#if !ENABLE(THREADED_HTML_PARSER)
- // This ASSERT triggers with the threaded HTML parser.
- // See https://bugs.webkit.org/show_bug.cgi?id=110937
</del><ins>+
</ins><span class="cx"> ASSERT(this == frameLoader()->activeDocumentLoader());
</span><del>-#endif
</del><span class="cx"> m_frame->document()->domWindow()->finishedLoading();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.in (162257 => 162258)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.in        2014-01-18 18:06:03 UTC (rev 162257)
+++ trunk/Source/WebCore/page/Settings.in        2014-01-18 18:25:30 UTC (rev 162258)
</span><span class="lines">@@ -158,9 +158,6 @@
</span><span class="cx"> applicationChromeMode initial=false
</span><span class="cx"> DOMPasteAllowed initial=false
</span><span class="cx">
</span><del>-threadedHTMLParser initial=false, conditional=THREADED_HTML_PARSER
-useThreadedHTMLParserForDataURLs initial=false, conditional=THREADED_HTML_PARSER
-
</del><span class="cx"> # When enabled, window.blur() does not change focus, and
</span><span class="cx"> # window.focus() only changes focus when invoked from the context that
</span><span class="cx"> # created the window.
</span></span></pre>
</div>
</div>
</body>
</html>