diff options
Diffstat (limited to 'Source/WebCore/html/parser/HTMLParserScheduler.cpp')
-rw-r--r-- | Source/WebCore/html/parser/HTMLParserScheduler.cpp | 27 |
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() |