OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 // the main thread, which means the speculation buffer is correct. | 423 // the main thread, which means the speculation buffer is correct. |
424 return; | 424 return; |
425 } | 425 } |
426 | 426 |
427 // Currently we're only smart enough to reuse the speculation buffer if the
tokenizer | 427 // Currently we're only smart enough to reuse the speculation buffer if the
tokenizer |
428 // both starts and ends in the DataState. That state is simplest because the
HTMLToken | 428 // both starts and ends in the DataState. That state is simplest because the
HTMLToken |
429 // is always in the Uninitialized state. We should consider whether we can r
euse the | 429 // is always in the Uninitialized state. We should consider whether we can r
euse the |
430 // speculation buffer in other states, but we'd likely need to do something
more | 430 // speculation buffer in other states, but we'd likely need to do something
more |
431 // sophisticated with the HTMLToken. | 431 // sophisticated with the HTMLToken. |
432 if (chunk->tokenizerState == HTMLTokenizer::DataState | 432 if (chunk->tokenizerState == HTMLTokenizer::DataState |
433 && tokenizer->state() == HTMLTokenizer::DataState | 433 && tokenizer->getState() == HTMLTokenizer::DataState |
434 && m_input.current().isEmpty() | 434 && m_input.current().isEmpty() |
435 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB
uilder.get())) { | 435 && chunk->treeBuilderState == HTMLTreeBuilderSimulator::stateFor(m_treeB
uilder.get())) { |
436 ASSERT(token->isUninitialized()); | 436 ASSERT(token->isUninitialized()); |
437 return; | 437 return; |
438 } | 438 } |
439 | 439 |
440 discardSpeculationsAndResumeFrom(chunk, token.release(), tokenizer.release()
); | 440 discardSpeculationsAndResumeFrom(chunk, token.release(), tokenizer.release()
); |
441 } | 441 } |
442 | 442 |
443 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk
> lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer>
tokenizer) | 443 void HTMLDocumentParser::discardSpeculationsAndResumeFrom(PassOwnPtr<ParsedChunk
> lastChunkBeforeScript, PassOwnPtr<HTMLToken> token, PassOwnPtr<HTMLTokenizer>
tokenizer) |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 | 673 |
674 if (isStopped()) | 674 if (isStopped()) |
675 return; | 675 return; |
676 | 676 |
677 // There should only be PendingText left since the tree-builder always flush
es | 677 // There should only be PendingText left since the tree-builder always flush
es |
678 // the task queue before returning. In case that ever changes, crash. | 678 // the task queue before returning. In case that ever changes, crash. |
679 m_treeBuilder->flush(FlushAlways); | 679 m_treeBuilder->flush(FlushAlways); |
680 RELEASE_ASSERT(!isStopped()); | 680 RELEASE_ASSERT(!isStopped()); |
681 | 681 |
682 if (isWaitingForScripts()) { | 682 if (isWaitingForScripts()) { |
683 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); | 683 ASSERT(m_tokenizer->getState() == HTMLTokenizer::DataState); |
684 | 684 |
685 ASSERT(m_preloader); | 685 ASSERT(m_preloader); |
686 // TODO(kouhei): m_preloader should be always available for synchronous
parsing case, | 686 // TODO(kouhei): m_preloader should be always available for synchronous
parsing case, |
687 // adding paranoia if for speculative crash fix for crbug.com/465478 | 687 // adding paranoia if for speculative crash fix for crbug.com/465478 |
688 if (m_preloader) { | 688 if (m_preloader) { |
689 if (!m_preloadScanner) { | 689 if (!m_preloadScanner) { |
690 m_preloadScanner = HTMLPreloadScanner::create( | 690 m_preloadScanner = HTMLPreloadScanner::create( |
691 m_options, | 691 m_options, |
692 document()->url(), | 692 document()->url(), |
693 CachedDocumentParameters::create(document()), | 693 CachedDocumentParameters::create(document()), |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1163 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1164 { | 1164 { |
1165 ASSERT(decoder); | 1165 ASSERT(decoder); |
1166 DecodedDataDocumentParser::setDecoder(decoder); | 1166 DecodedDataDocumentParser::setDecoder(decoder); |
1167 | 1167 |
1168 if (m_haveBackgroundParser) | 1168 if (m_haveBackgroundParser) |
1169 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); | 1169 HTMLParserThread::shared()->postTask(threadSafeBind(&BackgroundHTMLParse
r::setDecoder, AllowCrossThreadAccess(m_backgroundParser), takeDecoder())); |
1170 } | 1170 } |
1171 | 1171 |
1172 } // namespace blink | 1172 } // namespace blink |
OLD | NEW |