Changeset 150013 in webkit


Ignore:
Timestamp:
May 13, 2013 8:05:18 AM (11 years ago)
Author:
akling@apple.com
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):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150011 r150013  
     12013-05-13  Andreas Kling  <akling@apple.com>
     2
     3        Document: Use a DeferrableOneShotTimer to throw out StyleResolver when unused.
     4        <http://webkit.org/b/115929>
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Nothing exciting here, just replacing a rickety-looking punting mechanism with a proper
     9        DeferrableOneShotTimer. Note that the timeout changes from 60 to 30 seconds because DOST
     10        works by punting a full interval on next timeout.
     11
     12        * dom/Document.cpp:
     13        (WebCore::Document::Document):
     14        (WebCore::Document::didAccessStyleResolver):
     15        (WebCore::Document::styleResolverThrowawayTimerFired):
     16        * dom/Document.h:
     17        (Document):
     18
    1192013-05-13  Andreas Kling  <akling@apple.com>
    220
  • trunk/Source/WebCore/dom/Document.cpp

    r149957 r150013  
    414414uint64_t Document::s_globalTreeVersion = 0;
    415415
     416static const double timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 30;
     417
    416418Document::Document(Frame* frame, const KURL& url, unsigned documentClasses)
    417419    : ContainerNode(0, CreateDocument)
    418420    , TreeScope(this)
    419     , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired)
    420     , m_lastStyleResolverAccessTime(0)
     421    , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired, timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds)
    421422    , m_activeParserCount(0)
    422423    , m_contextFeatures(ContextFeatures::defaultSwitch())
     
    44664467void Document::didAccessStyleResolver()
    44674468{
    4468     static const int timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 60;
    4469     static const int holdOffTimeBeforeReschedulingTimerInSeconds = 5;
    4470 
    4471     double currentTime = WTF::currentTime();
    4472 
    4473     if (currentTime > m_lastStyleResolverAccessTime + holdOffTimeBeforeReschedulingTimerInSeconds) {
    4474         m_styleResolverThrowawayTimer.startOneShot(timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds);
    4475         m_lastStyleResolverAccessTime = currentTime;
    4476     }
    4477 }
    4478 
    4479 void Document::styleResolverThrowawayTimerFired(Timer<Document>*)
     4469    m_styleResolverThrowawayTimer.restart();
     4470}
     4471
     4472void Document::styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>*)
    44804473{
    44814474    ASSERT(!m_inStyleRecalc);
  • trunk/Source/WebCore/dom/Document.h

    r149959 r150013  
    12961296    void didAssociateFormControlsTimerFired(Timer<Document>*);
    12971297
    1298     void styleResolverThrowawayTimerFired(Timer<Document>*);
    1299     Timer<Document> m_styleResolverThrowawayTimer;
    1300     double m_lastStyleResolverAccessTime;
     1298    void styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>*);
     1299    DeferrableOneShotTimer<Document> m_styleResolverThrowawayTimer;
    13011300
    13021301    OwnPtr<StyleResolver> m_styleResolver;
Note: See TracChangeset for help on using the changeset viewer.