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

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

Issue 657753002: Remove state variables in PumpSession as they are no longer used. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 2 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 { 288 {
289 ASSERT(scriptingContentIsAllowed(parserContentPolicy())); 289 ASSERT(scriptingContentIsAllowed(parserContentPolicy()));
290 290
291 TextPosition scriptStartPosition = TextPosition::belowRangePosition(); 291 TextPosition scriptStartPosition = TextPosition::belowRangePosition();
292 RefPtrWillBeRawPtr<Element> scriptElement = m_treeBuilder->takeScriptToProce ss(scriptStartPosition); 292 RefPtrWillBeRawPtr<Element> scriptElement = m_treeBuilder->takeScriptToProce ss(scriptStartPosition);
293 // We will not have a scriptRunner when parsing a DocumentFragment. 293 // We will not have a scriptRunner when parsing a DocumentFragment.
294 if (m_scriptRunner) 294 if (m_scriptRunner)
295 m_scriptRunner->execute(scriptElement.release(), scriptStartPosition); 295 m_scriptRunner->execute(scriptElement.release(), scriptStartPosition);
296 } 296 }
297 297
298 bool HTMLDocumentParser::canTakeNextToken(PumpSession& session) 298 bool HTMLDocumentParser::canTakeNextToken()
299 { 299 {
300 if (isStopped()) 300 if (isStopped())
301 return false; 301 return false;
302 302
303 if (isWaitingForScripts()) { 303 if (isWaitingForScripts()) {
304 // If we don't run the script, we cannot allow the next token to be take n.
305 if (session.needsYield)
306 return false;
307
308 // If we're paused waiting for a script, we try to execute scripts befor e continuing. 304 // If we're paused waiting for a script, we try to execute scripts befor e continuing.
309 runScriptsForPausedTreeBuilder(); 305 runScriptsForPausedTreeBuilder();
310 if (isStopped()) 306 if (isStopped())
311 return false; 307 return false;
312 if (isWaitingForScripts()) 308 if (isWaitingForScripts())
313 return false; 309 return false;
314 } 310 }
315 311
316 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the 312 // FIXME: It's wrong for the HTMLDocumentParser to reach back to the
317 // LocalFrame, but this approach is how the old parser handled 313 // LocalFrame, but this approach is how the old parser handled
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // FIXME: m_input.current().length() is only accurate if we 576 // FIXME: m_input.current().length() is only accurate if we
581 // end up parsing the whole buffer in this pump. We should pass how 577 // end up parsing the whole buffer in this pump. We should pass how
582 // much we parsed as part of didWriteHTML instead of willWriteHTML. 578 // much we parsed as part of didWriteHTML instead of willWriteHTML.
583 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM L", "beginData", InspectorParseHtmlEvent::beginData(document(), m_input.current( ).currentLine().zeroBasedInt())); 579 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTM L", "beginData", InspectorParseHtmlEvent::beginData(document(), m_input.current( ).currentLine().zeroBasedInt()));
584 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 580 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
585 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 581 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
586 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteH TML(document(), m_input.current().currentLine().zeroBasedInt()); 582 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteH TML(document(), m_input.current().currentLine().zeroBasedInt());
587 583
588 m_xssAuditor.init(document(), &m_xssAuditorDelegate); 584 m_xssAuditor.init(document(), &m_xssAuditorDelegate);
589 585
590 while (canTakeNextToken(session) && !session.needsYield) { 586 while (canTakeNextToken()) {
591 if (!isParsingFragment()) 587 if (!isParsingFragment())
592 m_sourceTracker.start(m_input.current(), m_tokenizer.get(), token()) ; 588 m_sourceTracker.start(m_input.current(), m_tokenizer.get(), token()) ;
593 589
594 if (!m_tokenizer->nextToken(m_input.current(), token())) 590 if (!m_tokenizer->nextToken(m_input.current(), token()))
595 break; 591 break;
596 592
597 if (!isParsingFragment()) { 593 if (!isParsingFragment()) {
598 m_sourceTracker.end(m_input.current(), m_tokenizer.get(), token()); 594 m_sourceTracker.end(m_input.current(), m_tokenizer.get(), token());
599 595
600 // We do not XSS filter innerHTML, which means we (intentionally) fa il 596 // We do not XSS filter innerHTML, which means we (intentionally) fa il
(...skipping 13 matching lines...) Expand all
614 #endif 610 #endif
615 611
616 if (isStopped()) 612 if (isStopped())
617 return; 613 return;
618 614
619 // There should only be PendingText left since the tree-builder always flush es 615 // There should only be PendingText left since the tree-builder always flush es
620 // the task queue before returning. In case that ever changes, crash. 616 // the task queue before returning. In case that ever changes, crash.
621 m_treeBuilder->flush(FlushAlways); 617 m_treeBuilder->flush(FlushAlways);
622 RELEASE_ASSERT(!isStopped()); 618 RELEASE_ASSERT(!isStopped());
623 619
624 if (session.needsYield)
625 m_parserScheduler->scheduleForResume();
626
627 if (isWaitingForScripts()) { 620 if (isWaitingForScripts()) {
628 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState); 621 ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState);
629 if (!m_preloadScanner) { 622 if (!m_preloadScanner) {
630 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, docume nt()->url(), createMediaValues(document()))); 623 m_preloadScanner = adoptPtr(new HTMLPreloadScanner(m_options, docume nt()->url(), createMediaValues(document())));
631 m_preloadScanner->appendToEnd(m_input.current()); 624 m_preloadScanner->appendToEnd(m_input.current());
632 } 625 }
633 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL()); 626 m_preloadScanner->scan(m_preloader.get(), document()->baseElementURL());
634 } 627 }
635 628
636 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML" , "endLine", m_input.current().currentLine().zeroBasedInt()); 629 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML" , "endLine", m_input.current().currentLine().zeroBasedInt());
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder) 1047 void HTMLDocumentParser::setDecoder(PassOwnPtr<TextResourceDecoder> decoder)
1055 { 1048 {
1056 ASSERT(decoder); 1049 ASSERT(decoder);
1057 DecodedDataDocumentParser::setDecoder(decoder); 1050 DecodedDataDocumentParser::setDecoder(decoder);
1058 1051
1059 if (m_haveBackgroundParser) 1052 if (m_haveBackgroundParser)
1060 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder())); 1053 HTMLParserThread::shared()->postTask(bind(&BackgroundHTMLParser::setDeco der, m_backgroundParser, takeDecoder()));
1061 } 1054 }
1062 1055
1063 } 1056 }
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLDocumentParser.h ('k') | Source/core/html/parser/HTMLParserScheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698