Commit 209109c8 authored by eric@webkit.org's avatar eric@webkit.org

Clarify some usage of shouldUseThreading vs m_haveBackgroundParser, fixing about:blank parsing

https://bugs.webkit.org/show_bug.cgi?id=107664

Reviewed by Adam Barth.

The HTMLDocumentParser can be "supposed" to use a background parser
but not end up ever doing so for blank documents.  It's important
that we spin the forground parser at least once, so we end up
actually creating the about:blank document.

shouldUseThreading() means that threading is enabled and we should use it if we can.
m_haveBackgroundParser means that we actually are already using threading.
When we add full document.write support this will get a bit trickier still as
we'll need to be using both the foreground and background parsers.

This fixes about 20 tests in fast/frames and many others outside of fast/frames. :)

* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::prepareToStopParsing):
(WebCore::HTMLDocumentParser::resumeParsingAfterYield):
(WebCore::HTMLDocumentParser::finish):
(WebCore::HTMLDocumentParser::lineNumber):
(WebCore::HTMLDocumentParser::textPosition):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@140559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 70f4208c
2013-01-23 Eric Seidel <eric@webkit.org>
Clarify some usage of shouldUseThreading vs m_haveBackgroundParser, fixing about:blank parsing
https://bugs.webkit.org/show_bug.cgi?id=107664
Reviewed by Adam Barth.
The HTMLDocumentParser can be "supposed" to use a background parser
but not end up ever doing so for blank documents. It's important
that we spin the forground parser at least once, so we end up
actually creating the about:blank document.
shouldUseThreading() means that threading is enabled and we should use it if we can.
m_haveBackgroundParser means that we actually are already using threading.
When we add full document.write support this will get a bit trickier still as
we'll need to be using both the foreground and background parsers.
This fixes about 20 tests in fast/frames and many others outside of fast/frames. :)
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::prepareToStopParsing):
(WebCore::HTMLDocumentParser::resumeParsingAfterYield):
(WebCore::HTMLDocumentParser::finish):
(WebCore::HTMLDocumentParser::lineNumber):
(WebCore::HTMLDocumentParser::textPosition):
2013-01-17 Roger Fong <roger_fong@apple.com>
[Win] Remove dependence on Microsoft Embedded OpenType Font Engine (T2EMBED.DLL) from FontCustomPlatformData.cpp.
......@@ -149,7 +149,7 @@ void HTMLDocumentParser::prepareToStopParsing()
#if ENABLE(THREADED_HTML_PARSER)
// NOTE: This pump should only ever emit buffered character tokens,
// so ForceSynchronous vs. AllowYield should be meaningless.
if (!shouldUseThreading())
if (!m_haveBackgroundParser)
#endif
pumpTokenizerIfPossible(ForceSynchronous);
......@@ -202,7 +202,7 @@ bool HTMLDocumentParser::isScheduledForResume() const
// Used by HTMLParserScheduler
void HTMLDocumentParser::resumeParsingAfterYield()
{
ASSERT(!shouldUseThreading());
ASSERT(!m_haveBackgroundParser);
// pumpTokenizer can cause this parser to be detached from the Document,
// but we need to ensure it isn't deleted yet.
......@@ -586,7 +586,7 @@ void HTMLDocumentParser::finish()
// 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 (shouldUseThreading() && m_haveBackgroundParser) {
if (m_haveBackgroundParser) {
HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::finishPartial, ParserMap::identifierForParser(this)));
return;
}
......@@ -610,7 +610,7 @@ String HTMLDocumentParser::sourceForToken(const HTMLToken& token)
OrdinalNumber HTMLDocumentParser::lineNumber() const
{
#if ENABLE(THREADED_HTML_PARSER)
if (shouldUseThreading())
if (m_haveBackgroundParser)
return m_textPosition.m_line;
#endif
......@@ -620,7 +620,7 @@ OrdinalNumber HTMLDocumentParser::lineNumber() const
TextPosition HTMLDocumentParser::textPosition() const
{
#if ENABLE(THREADED_HTML_PARSER)
if (shouldUseThreading())
if (m_haveBackgroundParser)
return m_textPosition;
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment