Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 243823002: Flush pending text after every chunk of Tokens (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/platform/win/fast/text/large-text-composed-char-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
abarth-chromium 2014/04/18 21:51:03 Do we need this in the non-threaded case? Maybe w
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
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 }
OLDNEW
« no previous file with comments | « LayoutTests/platform/win/fast/text/large-text-composed-char-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698