Title: [140446] trunk/Source/WebCore
- Revision
- 140446
- Author
- aba...@webkit.org
- Date
- 2013-01-22 11:55:01 -0800 (Tue, 22 Jan 2013)
Log Message
Wean BackgroundHTMLParser off HTMLInputStream
https://bugs.webkit.org/show_bug.cgi?id=107575
Reviewed by Eric Seidel.
The BackgroundHTMLParser doesn't need to use HTMLInputStream because it
doesn't need to handle nested calls to document.write. Instead, we can
just use a SegmentedString directly, which will let us checkpoint
m_input for speculation.
* html/parser/BackgroundHTMLParser.cpp:
(WebCore::BackgroundHTMLParser::append):
(WebCore::BackgroundHTMLParser::finish):
(WebCore::BackgroundHTMLParser::markEndOfFile):
(WebCore):
(WebCore::BackgroundHTMLParser::pumpTokenizer):
* html/parser/BackgroundHTMLParser.h:
(BackgroundHTMLParser):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (140445 => 140446)
--- trunk/Source/WebCore/ChangeLog 2013-01-22 19:24:58 UTC (rev 140445)
+++ trunk/Source/WebCore/ChangeLog 2013-01-22 19:55:01 UTC (rev 140446)
@@ -1,3 +1,24 @@
+2013-01-22 Adam Barth <aba...@webkit.org>
+
+ Wean BackgroundHTMLParser off HTMLInputStream
+ https://bugs.webkit.org/show_bug.cgi?id=107575
+
+ Reviewed by Eric Seidel.
+
+ The BackgroundHTMLParser doesn't need to use HTMLInputStream because it
+ doesn't need to handle nested calls to document.write. Instead, we can
+ just use a SegmentedString directly, which will let us checkpoint
+ m_input for speculation.
+
+ * html/parser/BackgroundHTMLParser.cpp:
+ (WebCore::BackgroundHTMLParser::append):
+ (WebCore::BackgroundHTMLParser::finish):
+ (WebCore::BackgroundHTMLParser::markEndOfFile):
+ (WebCore):
+ (WebCore::BackgroundHTMLParser::pumpTokenizer):
+ * html/parser/BackgroundHTMLParser.h:
+ (BackgroundHTMLParser):
+
2013-01-22 Sergio Villar Senin <svil...@igalia.com>
[Soup] Random thread crashes
Modified: trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp (140445 => 140446)
--- trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp 2013-01-22 19:24:58 UTC (rev 140445)
+++ trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp 2013-01-22 19:55:01 UTC (rev 140446)
@@ -101,7 +101,7 @@
void BackgroundHTMLParser::append(const String& input)
{
- m_input.appendToEnd(input);
+ m_input.append(SegmentedString(input));
pumpTokenizer();
}
@@ -113,11 +113,21 @@
void BackgroundHTMLParser::finish()
{
- ASSERT(!m_input.haveSeenEndOfFile());
- m_input.markEndOfFile();
+ markEndOfFile();
pumpTokenizer();
}
+void BackgroundHTMLParser::markEndOfFile()
+{
+ // FIXME: This should use InputStreamPreprocessor::endOfFileMarker
+ // once InputStreamPreprocessor is split off into its own header.
+ const LChar endOfFileMarker = 0;
+
+ ASSERT(!m_input.isClosed());
+ m_input.append(SegmentedString(String(&endOfFileMarker, 1)));
+ m_input.close();
+}
+
void BackgroundHTMLParser::simulateTreeBuilder(const CompactHTMLToken& token)
{
if (token.type() == HTMLTokenTypes::StartTag) {
@@ -159,7 +169,7 @@
if (m_isPausedWaitingForScripts)
return;
- while (m_tokenizer->nextToken(m_input.current(), m_token)) {
+ while (m_tokenizer->nextToken(m_input, m_token)) {
m_pendingTokens.append(CompactHTMLToken(m_token));
m_token.clear();
Modified: trunk/Source/WebCore/html/parser/BackgroundHTMLParser.h (140445 => 140446)
--- trunk/Source/WebCore/html/parser/BackgroundHTMLParser.h 2013-01-22 19:24:58 UTC (rev 140445)
+++ trunk/Source/WebCore/html/parser/BackgroundHTMLParser.h 2013-01-22 19:55:01 UTC (rev 140446)
@@ -29,7 +29,6 @@
#if ENABLE(THREADED_HTML_PARSER)
#include "CompactHTMLToken.h"
-#include "HTMLInputStream.h"
#include "HTMLParserOptions.h"
#include "HTMLToken.h"
#include "HTMLTokenizer.h"
@@ -60,12 +59,13 @@
private:
explicit BackgroundHTMLParser(const HTMLParserOptions&, ParserIdentifier);
+ void markEndOfFile();
void pumpTokenizer();
void simulateTreeBuilder(const CompactHTMLToken&);
void sendTokensToMainThread();
- HTMLInputStream m_input;
+ SegmentedString m_input;
HTMLToken m_token;
bool m_isPausedWaitingForScripts;
bool m_inForeignContent; // FIXME: We need a stack of foreign content markers.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes