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

Unified Diff: Source/core/html/parser/HTMLDocumentParser.cpp

Issue 652813004: Move speculations pump scheduling logic to HTMLParserScheduler. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: explicit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLParserScheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/parser/HTMLDocumentParser.cpp
diff --git a/Source/core/html/parser/HTMLDocumentParser.cpp b/Source/core/html/parser/HTMLDocumentParser.cpp
index 0ef764d72dfd6938a2a8037a8ac49af17154a3ca..6ee8405790d03f3d313f37d2118ab19068f20724 100644
--- a/Source/core/html/parser/HTMLDocumentParser.cpp
+++ b/Source/core/html/parser/HTMLDocumentParser.cpp
@@ -43,7 +43,6 @@
#include "core/loader/DocumentLoader.h"
#include "platform/SharedBuffer.h"
#include "platform/TraceEvent.h"
-#include "platform/scheduler/Scheduler.h"
#include "public/platform/WebThreadedDataReceiver.h"
#include "wtf/Functional.h"
@@ -412,7 +411,7 @@ void HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Parse
{
TRACE_EVENT0("blink", "HTMLDocumentParser::processParsedChunkFromBackgroundParser");
- ASSERT_WITH_SECURITY_IMPLICATION(!document()->activeParserCount());
+ ASSERT_WITH_SECURITY_IMPLICATION(document()->activeParserCount() == 1);
ASSERT(!isParsingFragment());
ASSERT(!isWaitingForScripts());
ASSERT(!isStopped());
@@ -425,8 +424,6 @@ void HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Parse
ASSERT(!m_token);
ASSERT(!m_lastChunkBeforeScript);
- ActiveParserSession session(contextForParsingSession());
-
OwnPtr<ParsedChunk> chunk(popChunk);
OwnPtr<CompactHTMLTokenStream> tokens = chunk->tokens.release();
@@ -486,9 +483,6 @@ void HTMLDocumentParser::processParsedChunkFromBackgroundParser(PassOwnPtr<Parse
void HTMLDocumentParser::pumpPendingSpeculations()
{
- // FIXME: Share this constant with the parser scheduler.
- const double parserTimeLimit = 0.500;
-
#if !ENABLE(OILPAN)
// ASSERT that this object is both attached to the Document and protected.
ASSERT(refCount() >= 2);
@@ -507,8 +501,7 @@ void HTMLDocumentParser::pumpPendingSpeculations()
// FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willWriteHTML(document(), lineNumber().zeroBasedInt());
- double startTime = currentTime();
-
+ SpeculationsPumpSession session(contextForParsingSession());
while (!m_speculations.isEmpty()) {
processParsedChunkFromBackgroundParser(m_speculations.takeFirst());
@@ -516,10 +509,8 @@ void HTMLDocumentParser::pumpPendingSpeculations()
if (isStopped() || isWaitingForScripts())
break;
- if ((Scheduler::shared()->shouldYieldForHighPriorityWork() || currentTime() - startTime > parserTimeLimit) && !m_speculations.isEmpty()) {
- m_parserScheduler->scheduleForResume();
+ if (m_speculations.isEmpty() || m_parserScheduler->yieldIfNeeded(session))
break;
- }
}
TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ParseHTML", "endLine", lineNumber().zeroBasedInt());
« no previous file with comments | « no previous file | Source/core/html/parser/HTMLParserScheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698