Changeset 196633 in webkit


Ignore:
Timestamp:
Feb 16, 2016 2:00:15 AM (8 years ago)
Author:
akling@apple.com
Message:

Drop StyleResolver and SelectorQueryCache when entering PageCache.
<https://webkit.org/b/154238>

Reviewed by Antti Koivisto.

Source/WebCore:

Stop keeping these around for cached pages to save lots of memory.
We can easily rebuild them if a cached navigation occurs, and this
way we also don't need to worry about invalidating style for cached
pages in all the right places.

Restoring a cached page will now lead to a forced style recalc.
We don't try to defer this (beyond a zero-timer) since it's going
to happen anyway, and it's nicer to front-load the cost rather than
stuttering on the first user content interaction.

  • dom/Document.cpp:

(WebCore::Document::setInPageCache):

  • history/CachedPage.cpp:

(WebCore::CachedPage::restore):
(WebCore::CachedPage::clear): Deleted.

  • history/CachedPage.h:

(WebCore::CachedPage::markForVisitedLinkStyleRecalc): Deleted.
(WebCore::CachedPage::markForFullStyleRecalc): Deleted.

  • history/PageCache.cpp:

(WebCore::PageCache::markPagesForVisitedLinkStyleRecalc): Deleted.
(WebCore::PageCache::markPagesForFullStyleRecalc): Deleted.

  • history/PageCache.h:
  • page/Frame.cpp:

(WebCore::Frame::setPageAndTextZoomFactors): Deleted.

  • page/Page.cpp:

(WebCore::Page::setViewScaleFactor): Deleted.
(WebCore::Page::setDeviceScaleFactor): Deleted.
(WebCore::Page::setPagination): Deleted.
(WebCore::Page::setPaginationLineGridEnabled): Deleted.
(WebCore::Page::setVisitedLinkStore): Deleted.

Source/WebKit/win:

  • WebCoreSupport/WebVisitedLinkStore.cpp:

(WebVisitedLinkStore::removeAllVisitedLinks): Deleted.
(WebVisitedLinkStore::addVisitedLinkHash): Deleted.

Location:
trunk/Source
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r196632 r196633  
     12016-02-16  Andreas Kling  <akling@apple.com>
     2
     3        Drop StyleResolver and SelectorQueryCache when entering PageCache.
     4        <https://webkit.org/b/154238>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Stop keeping these around for cached pages to save lots of memory.
     9        We can easily rebuild them if a cached navigation occurs, and this
     10        way we also don't need to worry about invalidating style for cached
     11        pages in all the right places.
     12
     13        Restoring a cached page will now lead to a forced style recalc.
     14        We don't try to defer this (beyond a zero-timer) since it's going
     15        to happen anyway, and it's nicer to front-load the cost rather than
     16        stuttering on the first user content interaction.
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::setInPageCache):
     20        * history/CachedPage.cpp:
     21        (WebCore::CachedPage::restore):
     22        (WebCore::CachedPage::clear): Deleted.
     23        * history/CachedPage.h:
     24        (WebCore::CachedPage::markForVisitedLinkStyleRecalc): Deleted.
     25        (WebCore::CachedPage::markForFullStyleRecalc): Deleted.
     26        * history/PageCache.cpp:
     27        (WebCore::PageCache::markPagesForVisitedLinkStyleRecalc): Deleted.
     28        (WebCore::PageCache::markPagesForFullStyleRecalc): Deleted.
     29        * history/PageCache.h:
     30        * page/Frame.cpp:
     31        (WebCore::Frame::setPageAndTextZoomFactors): Deleted.
     32        * page/Page.cpp:
     33        (WebCore::Page::setViewScaleFactor): Deleted.
     34        (WebCore::Page::setDeviceScaleFactor): Deleted.
     35        (WebCore::Page::setPagination): Deleted.
     36        (WebCore::Page::setPaginationLineGridEnabled): Deleted.
     37        (WebCore::Page::setVisitedLinkStore): Deleted.
     38
    1392016-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
    240
  • trunk/Source/WebCore/dom/Document.cpp

    r196622 r196633  
    46004600        }
    46014601        m_styleRecalcTimer.stop();
     4602
     4603        clearStyleResolver();
     4604        clearSelectorQueryCache();
    46024605    } else {
    46034606        if (childNeedsStyleRecalc())
  • trunk/Source/WebCore/history/CachedPage.cpp

    r191451 r196633  
    7575    ASSERT(!page.subframeCount());
    7676
     77    page.setNeedsRecalcStyleInAllFrames();
     78
    7779    m_cachedMainFrame->open();
    7880   
     
    101103    }
    102104
    103     if (m_needStyleRecalcForVisitedLinks) {
    104         for (Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext())
    105             frame->document()->visitedLinkState().invalidateStyleForAllLinks();
    106     }
    107 
    108105    if (m_needsDeviceOrPageScaleChanged)
    109106        page.mainFrame().deviceOrPageScaleFactorChanged();
    110 
    111     if (m_needsFullStyleRecalc)
    112         page.setNeedsRecalcStyleInAllFrames();
    113107
    114108#if ENABLE(VIDEO_TRACK)
     
    130124    m_cachedMainFrame->clear();
    131125    m_cachedMainFrame = nullptr;
    132     m_needStyleRecalcForVisitedLinks = false;
    133     m_needsFullStyleRecalc = false;
    134126#if ENABLE(VIDEO_TRACK)
    135127    m_needsCaptionPreferencesChanged = false;
  • trunk/Source/WebCore/history/CachedPage.h

    r187587 r196633  
    5151    CachedFrame* cachedMainFrame() { return m_cachedMainFrame.get(); }
    5252
    53     void markForVisitedLinkStyleRecalc() { m_needStyleRecalcForVisitedLinks = true; }
    54     void markForFullStyleRecalc() { m_needsFullStyleRecalc = true; }
    5553#if ENABLE(VIDEO_TRACK)
    5654    void markForCaptionPreferencesChanged() { m_needsCaptionPreferencesChanged = true; }
     
    6462    double m_expirationTime;
    6563    std::unique_ptr<CachedFrame> m_cachedMainFrame;
    66     bool m_needStyleRecalcForVisitedLinks { false };
    67     bool m_needsFullStyleRecalc { false };
    6864#if ENABLE(VIDEO_TRACK)
    6965    bool m_needsCaptionPreferencesChanged { false };
  • trunk/Source/WebCore/history/PageCache.cpp

    r195605 r196633  
    312312}
    313313
    314 void PageCache::markPagesForVisitedLinkStyleRecalc()
    315 {
    316     for (auto& item : m_items) {
    317         ASSERT(item->m_cachedPage);
    318         item->m_cachedPage->markForVisitedLinkStyleRecalc();
    319     }
    320 }
    321 
    322 void PageCache::markPagesForFullStyleRecalc(Page& page)
    323 {
    324     for (auto& item : m_items) {
    325         CachedPage& cachedPage = *item->m_cachedPage;
    326         if (&page.mainFrame() == &cachedPage.cachedMainFrame()->view()->frame())
    327             cachedPage.markForFullStyleRecalc();
    328     }
    329 }
    330 
    331314void PageCache::markPagesForDeviceOrPageScaleChanged(Page& page)
    332315{
  • trunk/Source/WebCore/history/PageCache.h

    r195605 r196633  
    6262    WEBCORE_EXPORT unsigned frameCount() const;
    6363
    64     WEBCORE_EXPORT void markPagesForVisitedLinkStyleRecalc();
    65     // Will mark all cached pages associated with the given page as needing style recalc.
    66     void markPagesForFullStyleRecalc(Page&);
    6764    void markPagesForDeviceOrPageScaleChanged(Page&);
    6865    void markPagesForContentsSizeChanged(Page&);
  • trunk/Source/WebCore/page/Frame.cpp

    r194819 r196633  
    978978            view->layout();
    979979    }
    980 
    981     if (isMainFrame())
    982         PageCache::singleton().markPagesForFullStyleRecalc(*page);
    983980}
    984981
  • trunk/Source/WebCore/page/Page.cpp

    r196024 r196633  
    846846    m_viewScaleFactor = scale;
    847847    PageCache::singleton().markPagesForDeviceOrPageScaleChanged(*this);
    848     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    849848}
    850849
     
    864863    PageCache::singleton().markPagesForDeviceOrPageScaleChanged(*this);
    865864
    866     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    867865    GraphicsContext::updateDocumentMarkerResources();
    868866
     
    942940
    943941    setNeedsRecalcStyleInAllFrames();
    944     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    945942}
    946943
     
    953950   
    954951    setNeedsRecalcStyleInAllFrames();
    955     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    956952}
    957953
     
    17321728
    17331729    invalidateStylesForAllLinks();
    1734     PageCache::singleton().markPagesForFullStyleRecalc(*this);
    17351730}
    17361731
  • trunk/Source/WebKit/mac/WebCoreSupport/WebVisitedLinkStore.mm

    r179409 r196633  
    7575    for (auto& visitedLinkStore : visitedLinkStores())
    7676        visitedLinkStore->removeVisitedLinkHashes();
    77     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    7877}
    7978
     
    104103
    105104    invalidateStylesForLink(linkHash);
    106     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    107105}
    108106
     
    153151
    154152    invalidateStylesForLink(linkHash);
    155     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    156153}
    157154
  • trunk/Source/WebKit/win/ChangeLog

    r196569 r196633  
     12016-02-16  Andreas Kling  <akling@apple.com>
     2
     3        Drop StyleResolver and SelectorQueryCache when entering PageCache.
     4        <https://webkit.org/b/154238>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * WebCoreSupport/WebVisitedLinkStore.cpp:
     9        (WebVisitedLinkStore::removeAllVisitedLinks): Deleted.
     10        (WebVisitedLinkStore::addVisitedLinkHash): Deleted.
     11
    1122016-02-14  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/Source/WebKit/win/WebCoreSupport/WebVisitedLinkStore.cpp

    r185999 r196633  
    7272    for (auto& visitedLinkStore : visitedLinkStores())
    7373        visitedLinkStore->removeVisitedLinkHashes();
    74     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    7574}
    7675
     
    125124
    126125    invalidateStylesForLink(linkHash);
    127     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    128126}
    129127
  • trunk/Source/WebKit2/WebProcess/WebPage/VisitedLinkTableController.cpp

    r188895 r196633  
    9898
    9999    invalidateStylesForAllLinks();
    100     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    101100}
    102101
     
    105104    for (auto linkHash : linkHashes)
    106105        invalidateStylesForLink(linkHash);
    107     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    108106}
    109107
     
    111109{
    112110    invalidateStylesForAllLinks();
    113     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    114111}
    115112
     
    119116
    120117    invalidateStylesForAllLinks();
    121     PageCache::singleton().markPagesForVisitedLinkStyleRecalc();
    122118}
    123119
Note: See TracChangeset for help on using the changeset viewer.