Changeset 166740 in webkit


Ignore:
Timestamp:
Apr 3, 2014 1:56:33 PM (10 years ago)
Author:
akling@apple.com
Message:

Stop throwing away the Document's StyleResolver on a timer.
<https://webkit.org/b/131168>
<rdar://problem/15227045>

This was causing some unfortunate pauses when returning to idle pages
after a long-ish time. There's already a mechanism in place that will
throw these away if the system comes under memory pressure.

Reviewed by Sam Weinig.

  • css/StyleResolver.cpp:

(WebCore::StyleResolver::styleForElement):
(WebCore::StyleResolver::styleForKeyframe):
(WebCore::StyleResolver::pseudoStyleForElement):
(WebCore::StyleResolver::styleForPage):

  • dom/Document.cpp:

(WebCore::Document::Document):
(WebCore::Document::didAccessStyleResolver): Deleted.
(WebCore::Document::styleResolverThrowawayTimerFired): Deleted.

  • dom/Document.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r166739 r166740  
     12014-04-03  Andreas Kling  <akling@apple.com>
     2
     3        Stop throwing away the Document's StyleResolver on a timer.
     4        <https://webkit.org/b/131168>
     5        <rdar://problem/15227045>
     6
     7        This was causing some unfortunate pauses when returning to idle pages
     8        after a long-ish time. There's already a mechanism in place that will
     9        throw these away if the system comes under memory pressure.
     10
     11        Reviewed by Sam Weinig.
     12
     13        * css/StyleResolver.cpp:
     14        (WebCore::StyleResolver::styleForElement):
     15        (WebCore::StyleResolver::styleForKeyframe):
     16        (WebCore::StyleResolver::pseudoStyleForElement):
     17        (WebCore::StyleResolver::styleForPage):
     18        * dom/Document.cpp:
     19        (WebCore::Document::Document):
     20        (WebCore::Document::didAccessStyleResolver): Deleted.
     21        (WebCore::Document::styleResolverThrowawayTimerFired): Deleted.
     22        * dom/Document.h:
     23
    1242014-04-02  Simon Fraser  <simon.fraser@apple.com>
    225
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r166712 r166740  
    809809    state.clear(); // Clear out for the next resolve.
    810810
    811     document().didAccessStyleResolver();
    812 
    813811    // Now return the style.
    814812    return state.takeStyle();
     
    868866    }
    869867
    870     document().didAccessStyleResolver();
    871 
    872868    return state.takeStyle();
    873869}
     
    983979    loadPendingResources();
    984980
    985     document().didAccessStyleResolver();
    986 
    987981    // Now return the style.
    988982    return state.takeStyle();
     
    10241018    // Start loading resources referenced by this style.
    10251019    loadPendingResources();
    1026 
    1027     document().didAccessStyleResolver();
    10281020
    10291021    // Now return the style.
  • trunk/Source/WebCore/dom/Document.cpp

    r166680 r166740  
    380380uint64_t Document::s_globalTreeVersion = 0;
    381381
    382 static const double timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds = 30;
    383 
    384382#if ENABLE(IOS_TEXT_AUTOSIZING)
    385383void TextAutoSizingTraits::constructDeletedValue(TextAutoSizingKey& slot)
     
    409407#endif
    410408    , m_referencingNodeCount(0)
    411     , m_styleResolverThrowawayTimer(this, &Document::styleResolverThrowawayTimerFired, timeBeforeThrowingAwayStyleResolverAfterLastUseInSeconds)
    412409    , m_didCalculateStyleResolver(false)
    413410    , m_hasNodesWithPlaceholderStyle(false)
     
    44864483}
    44874484
    4488 void Document::didAccessStyleResolver()
    4489 {
    4490     m_styleResolverThrowawayTimer.restart();
    4491 }
    4492 
    4493 void Document::styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>&)
    4494 {
    4495     ASSERT(!m_inStyleRecalc);
    4496     clearStyleResolver();
    4497 }
    4498 
    44994485#if ENABLE(TELEPHONE_NUMBER_DETECTION)
    45004486// FIXME: Find a better place for this functionality.
  • trunk/Source/WebCore/dom/Document.h

    r166668 r166740  
    561561    void scheduleOptimizedStyleSheetUpdate();
    562562
    563     void didAccessStyleResolver();
    564 
    565563    void evaluateMediaQueryList();
    566564
     
    13561354    void didAssociateFormControlsTimerFired(Timer<Document>&);
    13571355
    1358     void styleResolverThrowawayTimerFired(DeferrableOneShotTimer<Document>&);
    1359 
    13601356    unsigned m_referencingNodeCount;
    1361 
    1362     DeferrableOneShotTimer<Document> m_styleResolverThrowawayTimer;
    13631357
    13641358    std::unique_ptr<StyleResolver> m_styleResolver;
Note: See TracChangeset for help on using the changeset viewer.