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

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

Issue 2752593003: Migrate WTF::Deque::first() to ::front() (Closed)
Patch Set: one more platform specific reference Created 3 years, 9 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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // document.write()s. The cancellation may have been triggered by 360 // document.write()s. The cancellation may have been triggered by
361 // script execution to signal an abrupt stop (e.g., window.close().) 361 // script execution to signal an abrupt stop (e.g., window.close().)
362 // 362 //
363 // The parser is unprepared to be told, and doesn't need to be. 363 // The parser is unprepared to be told, and doesn't need to be.
364 if (isExecutingScript() && pendingScript->resource()->wasCanceled()) { 364 if (isExecutingScript() && pendingScript->resource()->wasCanceled()) {
365 pendingScript->dispose(); 365 pendingScript->dispose();
366 366
367 if (pendingScript == parserBlockingScript()) { 367 if (pendingScript == parserBlockingScript()) {
368 m_parserBlockingScript = nullptr; 368 m_parserBlockingScript = nullptr;
369 } else { 369 } else {
370 CHECK_EQ(pendingScript, m_scriptsToExecuteAfterParsing.first()); 370 CHECK_EQ(pendingScript, m_scriptsToExecuteAfterParsing.front());
371 371
372 // TODO(hiroshige): Remove this CHECK() before going to beta. 372 // TODO(hiroshige): Remove this CHECK() before going to beta.
373 // This is only to make clusterfuzz to find a test case that executes 373 // This is only to make clusterfuzz to find a test case that executes
374 // this code path. 374 // this code path.
375 CHECK(false); 375 CHECK(false);
376 376
377 m_scriptsToExecuteAfterParsing.pop_front(); 377 m_scriptsToExecuteAfterParsing.pop_front();
378 // TODO(hiroshige): executeScriptsWaitingForParsing() should be 378 // TODO(hiroshige): executeScriptsWaitingForParsing() should be
379 // called later at the appropriate time. https://crbug.com/696775 379 // called later at the appropriate time. https://crbug.com/696775
380 } 380 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 // Step 3 of https://html.spec.whatwg.org/#the-end: 498 // Step 3 of https://html.spec.whatwg.org/#the-end:
499 // "If the list of scripts that will execute when the document has 499 // "If the list of scripts that will execute when the document has
500 // finished parsing is not empty, run these substeps:" 500 // finished parsing is not empty, run these substeps:"
501 bool HTMLParserScriptRunner::executeScriptsWaitingForParsing() { 501 bool HTMLParserScriptRunner::executeScriptsWaitingForParsing() {
502 TRACE_EVENT0("blink", 502 TRACE_EVENT0("blink",
503 "HTMLParserScriptRunner::executeScriptsWaitingForParsing"); 503 "HTMLParserScriptRunner::executeScriptsWaitingForParsing");
504 504
505 while (!m_scriptsToExecuteAfterParsing.isEmpty()) { 505 while (!m_scriptsToExecuteAfterParsing.isEmpty()) {
506 DCHECK(!isExecutingScript()); 506 DCHECK(!isExecutingScript());
507 DCHECK(!hasParserBlockingScript()); 507 DCHECK(!hasParserBlockingScript());
508 DCHECK(m_scriptsToExecuteAfterParsing.first()->resource()); 508 DCHECK(m_scriptsToExecuteAfterParsing.front()->resource());
509 509
510 // 1. "Spin the event loop until the first script in the list of scripts 510 // 1. "Spin the event loop until the first script in the list of scripts
511 // that will execute when the document has finished parsing 511 // that will execute when the document has finished parsing
512 // has its "ready to be parser-executed" flag set and 512 // has its "ready to be parser-executed" flag set and
513 // the parser's Document has no style sheet that is blocking scripts." 513 // the parser's Document has no style sheet that is blocking scripts."
514 // TODO(hiroshige): Is the latter part checked anywhere? 514 // TODO(hiroshige): Is the latter part checked anywhere?
515 if (!m_scriptsToExecuteAfterParsing.first()->isReady()) { 515 if (!m_scriptsToExecuteAfterParsing.front()->isReady()) {
516 m_scriptsToExecuteAfterParsing.first()->watchForLoad(this); 516 m_scriptsToExecuteAfterParsing.front()->watchForLoad(this);
517 traceParserBlockingScript(m_scriptsToExecuteAfterParsing.first().get(), 517 traceParserBlockingScript(m_scriptsToExecuteAfterParsing.front().get(),
518 !m_document->isScriptExecutionReady()); 518 !m_document->isScriptExecutionReady());
519 m_scriptsToExecuteAfterParsing.first()->markParserBlockingLoadStartTime(); 519 m_scriptsToExecuteAfterParsing.front()->markParserBlockingLoadStartTime();
520 return false; 520 return false;
521 } 521 }
522 522
523 // 3. "Remove the first script element from the list of scripts that will 523 // 3. "Remove the first script element from the list of scripts that will
524 // execute when the document has finished parsing (i.e. shift out the 524 // execute when the document has finished parsing (i.e. shift out the
525 // first entry in the list)." 525 // first entry in the list)."
526 PendingScript* first = m_scriptsToExecuteAfterParsing.takeFirst(); 526 PendingScript* first = m_scriptsToExecuteAfterParsing.takeFirst();
527 527
528 // 2. "Execute the first script in the list of scripts that will execute 528 // 2. "Execute the first script in the list of scripts that will execute
529 // when the document has finished parsing." 529 // when the document has finished parsing."
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 692
693 DEFINE_TRACE(HTMLParserScriptRunner) { 693 DEFINE_TRACE(HTMLParserScriptRunner) {
694 visitor->trace(m_document); 694 visitor->trace(m_document);
695 visitor->trace(m_host); 695 visitor->trace(m_host);
696 visitor->trace(m_parserBlockingScript); 696 visitor->trace(m_parserBlockingScript);
697 visitor->trace(m_scriptsToExecuteAfterParsing); 697 visitor->trace(m_scriptsToExecuteAfterParsing);
698 PendingScriptClient::trace(visitor); 698 PendingScriptClient::trace(visitor);
699 } 699 }
700 700
701 } // namespace blink 701 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698