summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/parser/HTMLParserScheduler.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/parser/HTMLParserScheduler.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/html/parser/HTMLParserScheduler.cpp')
-rw-r--r--Source/WebCore/html/parser/HTMLParserScheduler.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/Source/WebCore/html/parser/HTMLParserScheduler.cpp b/Source/WebCore/html/parser/HTMLParserScheduler.cpp
index 974fcbec9..28337d86d 100644
--- a/Source/WebCore/html/parser/HTMLParserScheduler.cpp
+++ b/Source/WebCore/html/parser/HTMLParserScheduler.cpp
@@ -32,11 +32,6 @@
#include "HTMLDocumentParser.h"
#include "Page.h"
-// defaultParserChunkSize is used to define how many tokens the parser will
-// process before checking against parserTimeLimit and possibly yielding.
-// This is a performance optimization to prevent checking after every token.
-static const int defaultParserChunkSize = 4096;
-
// defaultParserTimeLimit is the seconds the parser will run in one write() call
// before yielding. Inline <script> execution can cause it to exceed the limit.
// FIXME: We would like this value to be 0.2.
@@ -52,16 +47,6 @@ static double parserTimeLimit(Page* page)
return defaultParserTimeLimit;
}
-static int parserChunkSize(Page* page)
-{
- // FIXME: We may need to divide the value from customHTMLTokenizerChunkSize
- // by some constant to translate from the "character" based behavior of the
- // old LegacyHTMLDocumentParser to the token-based behavior of this parser.
- if (page && page->hasCustomHTMLTokenizerChunkSize())
- return page->customHTMLTokenizerChunkSize();
- return defaultParserChunkSize;
-}
-
ActiveParserSession::ActiveParserSession(Document* document)
: m_document(document)
{
@@ -85,7 +70,6 @@ PumpSession::PumpSession(unsigned& nestingLevel, Document* document)
// At that time we'll initialize startTime.
, processedTokens(INT_MAX)
, startTime(0)
- , needsYield(false)
, didSeeScript(false)
{
}
@@ -97,8 +81,7 @@ PumpSession::~PumpSession()
HTMLParserScheduler::HTMLParserScheduler(HTMLDocumentParser& parser)
: m_parser(parser)
, m_parserTimeLimit(parserTimeLimit(m_parser.document()->page()))
- , m_parserChunkSize(parserChunkSize(m_parser.document()->page()))
- , m_continueNextChunkTimer(this, &HTMLParserScheduler::continueNextChunkTimerFired)
+ , m_continueNextChunkTimer(*this, &HTMLParserScheduler::continueNextChunkTimerFired)
, m_isSuspendedWithActiveTimer(false)
#if !ASSERT_DISABLED
, m_suspended(false)
@@ -111,10 +94,9 @@ HTMLParserScheduler::~HTMLParserScheduler()
m_continueNextChunkTimer.stop();
}
-void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>& timer)
+void HTMLParserScheduler::continueNextChunkTimerFired()
{
ASSERT(!m_suspended);
- ASSERT_UNUSED(timer, &timer == &m_continueNextChunkTimer);
// FIXME: The timer class should handle timer priorities instead of this code.
// If a layout is scheduled, wait again to let the layout timer run first.
@@ -125,15 +107,14 @@ void HTMLParserScheduler::continueNextChunkTimerFired(Timer<HTMLParserScheduler>
m_parser.resumeParsingAfterYield();
}
-void HTMLParserScheduler::checkForYieldBeforeScript(PumpSession& session)
+bool HTMLParserScheduler::shouldYieldBeforeExecutingScript(PumpSession& session)
{
// If we've never painted before and a layout is pending, yield prior to running
// scripts to give the page a chance to paint earlier.
Document* document = m_parser.document();
bool needsFirstPaint = document->view() && !document->view()->hasEverPainted();
- if (needsFirstPaint && document->isLayoutTimerActive())
- session.needsYield = true;
session.didSeeScript = true;
+ return needsFirstPaint && document->isLayoutTimerActive();
}
void HTMLParserScheduler::scheduleForResume()