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

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

Issue 2223223002: [ParseHTMLOnMainThread] Force plaintext synchronously on lookahead parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add layout test Created 4 years, 4 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
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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 566 }
567 567
568 void HTMLDocumentParser::forcePlaintextForTextDocument() 568 void HTMLDocumentParser::forcePlaintextForTextDocument()
569 { 569 {
570 if (shouldUseThreading()) { 570 if (shouldUseThreading()) {
571 // This method is called before any data is appended, so we have to star t 571 // This method is called before any data is appended, so we have to star t
572 // the background parser ourselves. 572 // the background parser ourselves.
573 if (!m_haveBackgroundParser) 573 if (!m_haveBackgroundParser)
574 startBackgroundParser(); 574 startBackgroundParser();
575 575
576 postTaskToLookaheadParser(Asynchronous, &BackgroundHTMLParser::forcePlai ntextForTextDocument, m_backgroundParser); 576 // This task should be synchronous, because otherwise synchronous
577 // tokenizing can happen before plaintext is forced.
kouhei (in TOK) 2016/08/09 23:54:02 Would you note this in CL description too?
578 postTaskToLookaheadParser(Synchronous, &BackgroundHTMLParser::forcePlain textForTextDocument, m_backgroundParser);
577 } else 579 } else
578 m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState); 580 m_tokenizer->setState(HTMLTokenizer::PLAINTEXTState);
579 } 581 }
580 582
581 void HTMLDocumentParser::pumpTokenizer() 583 void HTMLDocumentParser::pumpTokenizer()
582 { 584 {
583 ASSERT(!isStopped()); 585 ASSERT(!isStopped());
584 ASSERT(m_tokenizer); 586 ASSERT(m_tokenizer);
585 ASSERT(m_token); 587 ASSERT(m_token);
586 588
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 (*WTF::bind(function, std::forward<Ps>(parameters)...))(); 1171 (*WTF::bind(function, std::forward<Ps>(parameters)...))();
1170 return; 1172 return;
1171 case Asynchronous: 1173 case Asynchronous:
1172 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std:: forward<Ps>(parameters)...)); 1174 m_loadingTaskRunner->postTask(BLINK_FROM_HERE, WTF::bind(function, std:: forward<Ps>(parameters)...));
1173 return; 1175 return;
1174 } 1176 }
1175 NOTREACHED(); 1177 NOTREACHED();
1176 } 1178 }
1177 1179
1178 } // namespace blink 1180 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698