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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 if (it->type() == HTMLToken::EndOfFile) { | 468 if (it->type() == HTMLToken::EndOfFile) { |
469 ASSERT(it + 1 == tokens->end()); // The EOF is assumed to be the las
t token of this bunch. | 469 ASSERT(it + 1 == tokens->end()); // The EOF is assumed to be the las
t token of this bunch. |
470 ASSERT(m_speculations.isEmpty()); // There should never be any chunk
s after the EOF. | 470 ASSERT(m_speculations.isEmpty()); // There should never be any chunk
s after the EOF. |
471 prepareToStopParsing(); | 471 prepareToStopParsing(); |
472 break; | 472 break; |
473 } | 473 } |
474 | 474 |
475 ASSERT(!m_tokenizer); | 475 ASSERT(!m_tokenizer); |
476 ASSERT(!m_token); | 476 ASSERT(!m_token); |
477 } | 477 } |
| 478 |
| 479 // Make sure any pending text nodes are emitted before returning. |
| 480 if (!isStopped()) |
| 481 m_treeBuilder->flush(); |
478 } | 482 } |
479 | 483 |
480 void HTMLDocumentParser::pumpPendingSpeculations() | 484 void HTMLDocumentParser::pumpPendingSpeculations() |
481 { | 485 { |
482 // FIXME: Share this constant with the parser scheduler. | 486 // FIXME: Share this constant with the parser scheduler. |
483 const double parserTimeLimit = 0.500; | 487 const double parserTimeLimit = 0.500; |
484 | 488 |
485 // ASSERT that this object is both attached to the Document and protected. | 489 // ASSERT that this object is both attached to the Document and protected. |
486 ASSERT(refCount() >= 2); | 490 ASSERT(refCount() >= 2); |
487 // If this assert fails, you need to call validateSpeculations to make sure | 491 // If this assert fails, you need to call validateSpeculations to make sure |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) | 1039 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) |
1036 { | 1040 { |
1037 ASSERT(decoder); | 1041 ASSERT(decoder); |
1038 DecodedDataDocumentParser::setDecoder(decoder); | 1042 DecodedDataDocumentParser::setDecoder(decoder); |
1039 | 1043 |
1040 if (m_haveBackgroundParser) | 1044 if (m_haveBackgroundParser) |
1041 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); | 1045 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco
der, m_backgroundParser, takeDecoder())); |
1042 } | 1046 } |
1043 | 1047 |
1044 } | 1048 } |
OLD | NEW |