[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:48:56 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 37c2fc09ad5e593f159cec61010917890d46bcc7
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 14 15:21:41 2009 +0000
2009-12-14 Yael Aharon <yael.aharon at nokia.com>
Reviewed by Antti Koivisto.
handling scripts can block UI
https://bugs.webkit.org/show_bug.cgi?id=27612
Break execution of external scrips to smaller chunks.
No new tests since no new functionality was introduced.
* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::HTMLTokenizer):
(WebCore::HTMLTokenizer::reset):
(WebCore::HTMLTokenizer::notifyFinished):
(WebCore::HTMLTokenizer::executeExternalScriptsIfReady):
(WebCore::HTMLTokenizer::executeExternalScriptsTimerFired):
(WebCore::HTMLTokenizer::continueExecutingExternalScripts):
* html/HTMLTokenizer.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52091 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 504498b..d49a489 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2009-12-14 Yael Aharon <yael.aharon at nokia.com>
+
+ Reviewed by Antti Koivisto.
+
+ handling scripts can block UI
+ https://bugs.webkit.org/show_bug.cgi?id=27612
+
+ Break execution of external scrips to smaller chunks.
+ No new tests since no new functionality was introduced.
+
+ * html/HTMLTokenizer.cpp:
+ (WebCore::HTMLTokenizer::HTMLTokenizer):
+ (WebCore::HTMLTokenizer::reset):
+ (WebCore::HTMLTokenizer::notifyFinished):
+ (WebCore::HTMLTokenizer::executeExternalScriptsIfReady):
+ (WebCore::HTMLTokenizer::executeExternalScriptsTimerFired):
+ (WebCore::HTMLTokenizer::continueExecutingExternalScripts):
+ * html/HTMLTokenizer.h:
+
2009-12-03 Holger Hans Peter Freyther <zecke at selfish.org>
Reviewed by Simon Hausmann.
diff --git a/WebCore/html/HTMLTokenizer.cpp b/WebCore/html/HTMLTokenizer.cpp
index 433820b..a4c4a38 100644
--- a/WebCore/html/HTMLTokenizer.cpp
+++ b/WebCore/html/HTMLTokenizer.cpp
@@ -167,6 +167,7 @@ HTMLTokenizer::HTMLTokenizer(HTMLDocument* doc, bool reportErrors)
, m_requestingScript(false)
, m_hasScriptsWaitingForStylesheets(false)
, m_timer(this, &HTMLTokenizer::timerFired)
+ , m_externalScriptsTimer(this, &HTMLTokenizer::executeExternalScriptsTimerFired)
, m_doc(doc)
, m_parser(new HTMLParser(doc, reportErrors))
, m_inWrite(false)
@@ -186,6 +187,7 @@ HTMLTokenizer::HTMLTokenizer(HTMLViewSourceDocument* doc)
, m_requestingScript(false)
, m_hasScriptsWaitingForStylesheets(false)
, m_timer(this, &HTMLTokenizer::timerFired)
+ , m_externalScriptsTimer(this, &HTMLTokenizer::executeExternalScriptsTimerFired)
, m_doc(doc)
, m_parser(0)
, m_inWrite(false)
@@ -204,6 +206,7 @@ HTMLTokenizer::HTMLTokenizer(DocumentFragment* frag)
, m_requestingScript(false)
, m_hasScriptsWaitingForStylesheets(false)
, m_timer(this, &HTMLTokenizer::timerFired)
+ , m_externalScriptsTimer(this, &HTMLTokenizer::executeExternalScriptsTimerFired)
, m_doc(frag->document())
, m_parser(new HTMLParser(frag))
, m_inWrite(false)
@@ -232,6 +235,8 @@ void HTMLTokenizer::reset()
m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0;
m_timer.stop();
+ m_externalScriptsTimer.stop();
+
m_state.setAllowYield(false);
m_state.setForceSynchronous(false);
@@ -2007,6 +2012,11 @@ void HTMLTokenizer::executeScriptsWaitingForStylesheets()
void HTMLTokenizer::notifyFinished(CachedResource*)
{
+ executeExternalScriptsIfReady();
+}
+
+void HTMLTokenizer::executeExternalScriptsIfReady()
+{
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
if (!m_doc->ownerElement())
printf("script loaded at %d\n", m_doc->elapsedTime());
@@ -2021,7 +2031,12 @@ void HTMLTokenizer::notifyFinished(CachedResource*)
return;
bool finished = false;
+
+ double startTime = currentTime();
while (!finished && m_pendingScripts.first()->isLoaded()) {
+ if (!continueExecutingExternalScripts(startTime))
+ break;
+
CachedScript* cs = m_pendingScripts.first().get();
m_pendingScripts.removeFirst();
ASSERT(cache()->disabled() || cs->accessCount() > 0);
@@ -2081,6 +2096,31 @@ void HTMLTokenizer::notifyFinished(CachedResource*)
}
}
+void HTMLTokenizer::executeExternalScriptsTimerFired(Timer<HTMLTokenizer>*)
+{
+ if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) {
+ // Restart the timer and do layout first.
+ m_externalScriptsTimer.startOneShot(0);
+ return;
+ }
+
+ // Continue executing external scripts.
+ executeExternalScriptsIfReady();
+}
+
+bool HTMLTokenizer::continueExecutingExternalScripts(double startTime)
+{
+ if (m_externalScriptsTimer.isActive())
+ return false;
+
+ if (currentTime() - startTime > m_tokenizerTimeDelay) {
+ // Schedule the timer to keep processing as soon as possible.
+ m_externalScriptsTimer.startOneShot(0);
+ return false;
+ }
+ return true;
+}
+
bool HTMLTokenizer::isWaitingForScripts() const
{
return m_state.loadingExtScript();
diff --git a/WebCore/html/HTMLTokenizer.h b/WebCore/html/HTMLTokenizer.h
index d731b2d..2516eda 100644
--- a/WebCore/html/HTMLTokenizer.h
+++ b/WebCore/html/HTMLTokenizer.h
@@ -205,6 +205,10 @@ private:
// from CachedResourceClient
void notifyFinished(CachedResource*);
+ void executeExternalScriptsIfReady();
+ void executeExternalScriptsTimerFired(Timer<HTMLTokenizer>*);
+ bool continueExecutingExternalScripts(double startTime);
+
// Internal buffers
///////////////////
UChar* m_buffer;
@@ -401,6 +405,9 @@ private:
// The timer for continued processing.
Timer<HTMLTokenizer> m_timer;
+ // The timer for continued executing external scripts.
+ Timer<HTMLTokenizer> m_externalScriptsTimer;
+
// This buffer can hold arbitrarily long user-defined attribute names, such as in EMBED tags.
// So any fixed number might be too small, but rather than rewriting all usage of this buffer
// we'll just make it large enough to handle all imaginable cases.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list