Changeset 140446 in webkit


Ignore:
Timestamp:
Jan 22, 2013 11:55:01 AM (11 years ago)
Author:
abarth@webkit.org
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140445 r140446  
     12013-01-22  Adam Barth  <abarth@webkit.org>
     2
     3        Wean BackgroundHTMLParser off HTMLInputStream
     4        https://bugs.webkit.org/show_bug.cgi?id=107575
     5
     6        Reviewed by Eric Seidel.
     7
     8        The BackgroundHTMLParser doesn't need to use HTMLInputStream because it
     9        doesn't need to handle nested calls to document.write. Instead, we can
     10        just use a SegmentedString directly, which will let us checkpoint
     11        m_input for speculation.
     12
     13        * html/parser/BackgroundHTMLParser.cpp:
     14        (WebCore::BackgroundHTMLParser::append):
     15        (WebCore::BackgroundHTMLParser::finish):
     16        (WebCore::BackgroundHTMLParser::markEndOfFile):
     17        (WebCore):
     18        (WebCore::BackgroundHTMLParser::pumpTokenizer):
     19        * html/parser/BackgroundHTMLParser.h:
     20        (BackgroundHTMLParser):
     21
    1222013-01-22  Sergio Villar Senin  <svillar@igalia.com>
    223
  • trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp

    r140441 r140446  
    102102void BackgroundHTMLParser::append(const String& input)
    103103{
    104     m_input.appendToEnd(input);
     104    m_input.append(SegmentedString(input));
    105105    pumpTokenizer();
    106106}
     
    114114void BackgroundHTMLParser::finish()
    115115{
    116     ASSERT(!m_input.haveSeenEndOfFile());
    117     m_input.markEndOfFile();
     116    markEndOfFile();
    118117    pumpTokenizer();
     118}
     119
     120void BackgroundHTMLParser::markEndOfFile()
     121{
     122    // FIXME: This should use InputStreamPreprocessor::endOfFileMarker
     123    // once InputStreamPreprocessor is split off into its own header.
     124    const LChar endOfFileMarker = 0;
     125
     126    ASSERT(!m_input.isClosed());
     127    m_input.append(SegmentedString(String(&endOfFileMarker, 1)));
     128    m_input.close();
    119129}
    120130
     
    160170        return;
    161171
    162     while (m_tokenizer->nextToken(m_input.current(), m_token)) {
     172    while (m_tokenizer->nextToken(m_input, m_token)) {
    163173        m_pendingTokens.append(CompactHTMLToken(m_token));
    164174        m_token.clear();
  • trunk/Source/WebCore/html/parser/BackgroundHTMLParser.h

    r140441 r140446  
    3030
    3131#include "CompactHTMLToken.h"
    32 #include "HTMLInputStream.h"
    3332#include "HTMLParserOptions.h"
    3433#include "HTMLToken.h"
     
    6160    explicit BackgroundHTMLParser(const HTMLParserOptions&, ParserIdentifier);
    6261
     62    void markEndOfFile();
    6363    void pumpTokenizer();
    6464    void simulateTreeBuilder(const CompactHTMLToken&);
     
    6666    void sendTokensToMainThread();
    6767
    68     HTMLInputStream m_input;
     68    SegmentedString m_input;
    6969    HTMLToken m_token;
    7070    bool m_isPausedWaitingForScripts;
Note: See TracChangeset for help on using the changeset viewer.