Title: [150013] trunk/Source/WebCore
- Revision
- 150013
- Author
- [email protected]
- Date
- 2013-05-13 08:05:18 -0700 (Mon, 13 May 2013)
Log Message
Document: Use a DeferrableOneShotTimer to throw out StyleResolver when unused.
<http://webkit.org/b/115929>
Reviewed by Anders Carlsson.
Nothing exciting here, just replacing a rickety-looking punting mechanism with a proper
DeferrableOneShotTimer. Note that the timeout changes from 60 to 30 seconds because DOST
works by punting a full interval on next timeout.
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::didAccessStyleResolver):
(WebCore::Document::styleResolverThrowawayTimerFired):
* dom/Document.h:
(Document):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150012 => 150013)
--- trunk/Source/WebCore/ChangeLog 2013-05-13 14:59:15 UTC (rev 150012)
+++ trunk/Source/WebCore/ChangeLog 2013-05-13 15:05:18 UTC (rev 150013)
@@ -1,5 +1,23 @@
2013-05-13 Andreas Kling <[email protected]>
+ Document: Use a DeferrableOneShotTimer to throw out StyleResolver when unused.
+ <http://webkit.org/b/115929>
+
+ Reviewed by Anders Carlsson.
+
+ Nothing exciting here, just replacing a rickety-looking punting mechanism with a proper
+ DeferrableOneShotTimer. Note that the timeout changes from 60 to 30 seconds because DOST
+ works by punting a full interval on next timeout.
+
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::didAccessStyleResolver):
+ (WebCore::Document::styleResolverThrowawayTimerFired):
+ * dom/Document.h:
+ (Document):
+
+2013-05-13 Andreas Kling <[email protected]>
+
REGRESSION(r149287): FoldingText only shows me half of my text.
<http://webkit.org/b/115956>
<rdar://problem/13831099>
Modified: trunk/Source/WebCore/dom/Document.cpp (150012 => 150013)
--- trunk/Source/WebCore/dom/Document.cpp 2013-05-13 14:59:15 UTC (rev 150012)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-05-13 15:05:18 UTC (rev 150013)
@@ -413,11 +413,12 @@
uint64_t Document::s_globalTreeVersion = 0;
+static const double timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 30;
+
Document::Document(Frame* frame, const KURL& url, unsigned documentClasses)
: ContainerNode(0, CreateDocument)
, TreeScope(this)
- , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired)
- , m_lastStyleResolverAccessTime(0)
+ , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired, timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds)
, m_activeParserCount(0)
, m_contextFeatures(ContextFeatures::defaultSwitch())
, m_compatibilityMode(NoQuirksMode)
@@ -4465,18 +4466,10 @@
void Document::didAccessStyleResolver()
{
- static const int timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 60;
- static const int holdOffTimeBeforeReschedulingTimerInSeconds = 5;
-
- double currentTime = WTF::currentTime();
-
- if (currentTime > m_lastStyleResolverAccessTime + holdOffTimeBeforeReschedulingTimerInSeconds) {
- m_styleResolverThrowawayTimer.startOneShot(timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds);
- m_lastStyleResolverAccessTime = currentTime;
- }
+ m_styleResolverThrowawayTimer.restart();
}
-void Document::styleResolverThrowawayTimerFired(Timer<Document>*)
+void Document::styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>*)
{
ASSERT(!m_inStyleRecalc);
clearStyleResolver();
Modified: trunk/Source/WebCore/dom/Document.h (150012 => 150013)
--- trunk/Source/WebCore/dom/Document.h 2013-05-13 14:59:15 UTC (rev 150012)
+++ trunk/Source/WebCore/dom/Document.h 2013-05-13 15:05:18 UTC (rev 150013)
@@ -1295,9 +1295,8 @@
void didAssociateFormControlsTimerFired(Timer<Document>*);
- void styleResolverThrowawayTimerFired(Timer<Document>*);
- Timer<Document> m_styleResolverThrowawayTimer;
- double m_lastStyleResolverAccessTime;
+ void styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>*);
+ DeferrableOneShotTimer<Document> m_styleResolverThrowawayTimer;
OwnPtr<StyleResolver> m_styleResolver;
bool m_didCalculateStyleResolver;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes