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

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

Issue 2224923002: Use Networking task source for parser tasks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 ASSERT(m_parserBlockingScript->resource()); 353 ASSERT(m_parserBlockingScript->resource());
354 354
355 // We only care about a load callback if resource is not already 355 // We only care about a load callback if resource is not already
356 // in the cache. Callers will attempt to run the m_parserBlockingScript 356 // in the cache. Callers will attempt to run the m_parserBlockingScript
357 // if possible before returning control to the parser. 357 // if possible before returning control to the parser.
358 if (!m_parserBlockingScript->isReady()) { 358 if (!m_parserBlockingScript->isReady()) {
359 if (m_document->frame()) { 359 if (m_document->frame()) {
360 ScriptState* scriptState = ScriptState::forMainWorld(m_document->fra me()); 360 ScriptState* scriptState = ScriptState::forMainWorld(m_document->fra me());
361 if (scriptState) 361 if (scriptState)
362 ScriptStreamer::startStreaming(m_parserBlockingScript.get(), Scr iptStreamer::ParsingBlocking, m_document->frame()->settings(), scriptState, Task RunnerHelper::getLoadingTaskRunner(m_document)); 362 ScriptStreamer::startStreaming(m_parserBlockingScript.get(), Scr iptStreamer::ParsingBlocking, m_document->frame()->settings(), scriptState, Task RunnerHelper::get(TaskType::Networking, m_document));
363 } 363 }
364 364
365 m_parserBlockingScript->watchForLoad(this); 365 m_parserBlockingScript->watchForLoad(this);
366 } 366 }
367 } 367 }
368 368
369 void HTMLScriptRunner::requestDeferredScript(Element* element) 369 void HTMLScriptRunner::requestDeferredScript(Element* element)
370 { 370 {
371 PendingScript* pendingScript = PendingScript::create(nullptr, nullptr); 371 PendingScript* pendingScript = PendingScript::create(nullptr, nullptr);
372 if (!requestPendingScript(pendingScript, element)) 372 if (!requestPendingScript(pendingScript, element))
373 return; 373 return;
374 374
375 if (m_document->frame() && !pendingScript->isReady()) { 375 if (m_document->frame() && !pendingScript->isReady()) {
376 ScriptState* scriptState = ScriptState::forMainWorld(m_document->frame() ); 376 ScriptState* scriptState = ScriptState::forMainWorld(m_document->frame() );
377 if (scriptState) 377 if (scriptState)
378 ScriptStreamer::startStreaming(pendingScript, ScriptStreamer::Deferr ed, m_document->frame()->settings(), scriptState, TaskRunnerHelper::getLoadingTa skRunner(m_document)); 378 ScriptStreamer::startStreaming(pendingScript, ScriptStreamer::Deferr ed, m_document->frame()->settings(), scriptState, TaskRunnerHelper::get(TaskType ::Networking, m_document));
379 } 379 }
380 380
381 ASSERT(pendingScript->resource()); 381 ASSERT(pendingScript->resource());
382 m_scriptsToExecuteAfterParsing.append(pendingScript); 382 m_scriptsToExecuteAfterParsing.append(pendingScript);
383 } 383 }
384 384
385 bool HTMLScriptRunner::requestPendingScript(PendingScript* pendingScript, Elemen t* script) const 385 bool HTMLScriptRunner::requestPendingScript(PendingScript* pendingScript, Elemen t* script) const
386 { 386 {
387 ASSERT(!pendingScript->element()); 387 ASSERT(!pendingScript->element());
388 pendingScript->setElement(script); 388 pendingScript->setElement(script);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 DEFINE_TRACE(HTMLScriptRunner) 447 DEFINE_TRACE(HTMLScriptRunner)
448 { 448 {
449 visitor->trace(m_document); 449 visitor->trace(m_document);
450 visitor->trace(m_host); 450 visitor->trace(m_host);
451 visitor->trace(m_parserBlockingScript); 451 visitor->trace(m_parserBlockingScript);
452 visitor->trace(m_scriptsToExecuteAfterParsing); 452 visitor->trace(m_scriptsToExecuteAfterParsing);
453 ScriptResourceClient::trace(visitor); 453 ScriptResourceClient::trace(visitor);
454 } 454 }
455 455
456 } // namespace blink 456 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698