diff options
author | Ben Murdoch <benm@google.com> | 2011-06-02 12:07:03 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-10 10:47:21 +0100 |
commit | 2daae5fd11344eaa88a0d92b0f6d65f8d2255c00 (patch) | |
tree | e4964fbd1cb70599f7718ff03e50ea1dab33890b /Source/WebCore/html/parser/HTMLParserScheduler.h | |
parent | 87bdf0060a247bfbe668342b87e0874182e0ffa9 (diff) | |
download | external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.zip external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.gz external_webkit-2daae5fd11344eaa88a0d92b0f6d65f8d2255c00.tar.bz2 |
Merge WebKit at r84325: Initial merge by git.
Change-Id: Ic1a909300ecc0a13ddc6b4e784371d2ac6e3d59b
Diffstat (limited to 'Source/WebCore/html/parser/HTMLParserScheduler.h')
-rw-r--r-- | Source/WebCore/html/parser/HTMLParserScheduler.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/WebCore/html/parser/HTMLParserScheduler.h b/Source/WebCore/html/parser/HTMLParserScheduler.h index 730b52b..b0e2e85 100644 --- a/Source/WebCore/html/parser/HTMLParserScheduler.h +++ b/Source/WebCore/html/parser/HTMLParserScheduler.h @@ -26,6 +26,8 @@ #ifndef HTMLParserScheduler_h #define HTMLParserScheduler_h +#include <limits.h> + #include "NestingLevelIncrementer.h" #include "Timer.h" #include <wtf/CurrentTime.h> @@ -39,8 +41,11 @@ class PumpSession : public NestingLevelIncrementer { public: PumpSession(unsigned& nestingLevel) : NestingLevelIncrementer(nestingLevel) - , processedTokens(0) - , startTime(currentTime()) + // Setting processedTokens to INT_MAX causes us to check for yields + // after any token during any parse where yielding is allowed. + // At that time we'll initialize startTime. + , processedTokens(INT_MAX) + , startTime(0) , needsYield(false) { } @@ -63,6 +68,11 @@ public: void checkForYieldBeforeToken(PumpSession& session) { if (session.processedTokens > m_parserChunkSize) { + // currentTime() can be expensive. By delaying, we avoided calling + // currentTime() when constructing non-yielding PumpSessions. + if (!session.startTime) + session.startTime = currentTime(); + session.processedTokens = 0; double elapsedTime = currentTime() - session.startTime; if (elapsedTime > m_parserTimeLimit) |