| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 ASSERT(!m_input.isClosed()); | 107 ASSERT(!m_input.isClosed()); |
| 108 m_input.append(SegmentedString(String(&kEndOfFileMarker, 1))); | 108 m_input.append(SegmentedString(String(&kEndOfFileMarker, 1))); |
| 109 m_input.close(); | 109 m_input.close(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 bool BackgroundHTMLParser::updateTokenizerState(const CompactHTMLToken& token) | 112 bool BackgroundHTMLParser::updateTokenizerState(const CompactHTMLToken& token) |
| 113 { | 113 { |
| 114 if (token.type() == HTMLToken::StartTag) { | 114 if (token.type() == HTMLToken::StartTag) { |
| 115 const String& tagName = token.data(); | 115 const String& tagName = token.data(); |
| 116 if (threadSafeMatch(tagName, HTMLNames::scriptTag) || threadSafeMatch(ta
gName, HTMLNames::styleTag)) | 116 if (threadSafeMatch(tagName, HTMLNames::scriptTag) || threadSafeMatch(ta
gName, HTMLNames::styleTag)) |
| 117 m_tokenizer->setState(HTMLTokenizer::RAWTEXTState); | 117 m_tokenizer->setState(HTMLTokenizer::RawDataState); |
| 118 } | 118 } |
| 119 | 119 |
| 120 return token.type() != HTMLToken::EndTag || !threadSafeMatch(token.data(), H
TMLNames::scriptTag); | 120 return token.type() != HTMLToken::EndTag || !threadSafeMatch(token.data(), H
TMLNames::scriptTag); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void BackgroundHTMLParser::pumpTokenizer() | 123 void BackgroundHTMLParser::pumpTokenizer() |
| 124 { | 124 { |
| 125 while (true) { | 125 while (true) { |
| 126 if (!m_tokenizer->nextToken(m_input, *m_token)) { | 126 if (!m_tokenizer->nextToken(m_input, *m_token)) { |
| 127 // We've reached the end of our current input. | 127 // We've reached the end of our current input. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 151 #endif | 151 #endif |
| 152 | 152 |
| 153 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar
ser::ParsedChunk); | 153 OwnPtr<HTMLDocumentParser::ParsedChunk> chunk = adoptPtr(new HTMLDocumentPar
ser::ParsedChunk); |
| 154 chunk->tokens = m_pendingTokens.release(); | 154 chunk->tokens = m_pendingTokens.release(); |
| 155 callOnMainThread(bind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgrou
ndParser, m_parser, chunk.release())); | 155 callOnMainThread(bind(&HTMLDocumentParser::didReceiveParsedChunkFromBackgrou
ndParser, m_parser, chunk.release())); |
| 156 | 156 |
| 157 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); | 157 m_pendingTokens = adoptPtr(new CompactHTMLTokenStream); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } | 160 } |
| OLD | NEW |