Changeset 255071 in webkit


Ignore:
Timestamp:
Jan 24, 2020 7:26:24 AM (4 years ago)
Author:
Antti Koivisto
Message:

[LFC][Integration] Clear inline item caches on low memory notification
https://bugs.webkit.org/show_bug.cgi?id=206740
<rdar://problem/58773905>

Reviewed by Zalan Bujtas.

Clear inline item caches on low memory notification.

  • layout/inlineformatting/InlineFormattingState.h:
  • layout/integration/LayoutIntegrationLineLayout.cpp:

(WebCore::LayoutIntegration::LineLayout::releaseCaches):
(WebCore::LayoutIntegration::LineLayout::releaseInlineItemCache):

  • layout/integration/LayoutIntegrationLineLayout.h:

Remove inline capacity. It is rarely optimal and we can afford the heap allocation.

  • page/MemoryRelease.cpp:

(WebCore::releaseNoncriticalMemory):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r255070 r255071  
     12020-01-24  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][Integration] Clear inline item caches on low memory notification
     4        https://bugs.webkit.org/show_bug.cgi?id=206740
     5        <rdar://problem/58773905>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        Clear inline item caches on low memory notification.
     10
     11        * layout/inlineformatting/InlineFormattingState.h:
     12        * layout/integration/LayoutIntegrationLineLayout.cpp:
     13        (WebCore::LayoutIntegration::LineLayout::releaseCaches):
     14        (WebCore::LayoutIntegration::LineLayout::releaseInlineItemCache):
     15        * layout/integration/LayoutIntegrationLineLayout.h:
     16
     17        Remove inline capacity. It is rarely optimal and we can afford the heap allocation.
     18
     19        * page/MemoryRelease.cpp:
     20        (WebCore::releaseNoncriticalMemory):
     21
    1222020-01-24  Adrian Perez de Castro  <aperez@igalia.com>
    223
  • trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h

    r254808 r255071  
    3636namespace Layout {
    3737
    38 using InlineItems = Vector<InlineItem, 30>;
     38using InlineItems = Vector<InlineItem>;
    3939
    4040// InlineFormattingState holds the state for a particular inline formatting context tree.
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

    r255068 r255071  
    4242#include "RenderBlockFlow.h"
    4343#include "RenderChildIterator.h"
     44#include "RenderDescendantIterator.h"
    4445#include "RenderLineBreak.h"
     46#include "RenderView.h"
    4547#include "RuntimeEnabledFeatures.h"
    4648#include "Settings.h"
     
    330332}
    331333
     334void LineLayout::releaseCaches(RenderView& view)
     335{
     336    if (!RuntimeEnabledFeatures::sharedFeatures().layoutFormattingContextIntegrationEnabled())
     337        return;
     338
     339    for (auto& renderer : descendantsOfType<RenderBlockFlow>(view)) {
     340        if (auto* lineLayout = renderer.layoutFormattingContextLineLayout())
     341            lineLayout->releaseInlineItemCache();
     342    }
     343}
     344
     345void LineLayout::releaseInlineItemCache()
     346{
     347    m_inlineFormattingState.inlineItems().clear();
     348}
     349
     350
    332351}
    333352}
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

    r254853 r255071  
    8181    LineLayoutTraversal::ElementBoxIterator elementBoxFor(const RenderLineBreak&) const;
    8282
     83    static void releaseCaches(RenderView&);
     84
    8385private:
    8486    const Layout::Container& rootLayoutBox() const;
    8587    Layout::Container& rootLayoutBox();
    8688    ShadowData* debugTextShadow();
     89    void releaseInlineItemCache();
    8790
    8891    const RenderBlockFlow& m_flow;
  • trunk/Source/WebCore/page/MemoryRelease.cpp

    r251220 r255071  
    4141#include "InlineStyleSheetOwner.h"
    4242#include "InspectorInstrumentation.h"
     43#include "LayoutIntegrationLineLayout.h"
    4344#include "Logging.h"
    4445#include "MemoryCache.h"
     
    6970    TextPainter::clearGlyphDisplayLists();
    7071
    71     for (auto* document : Document::allDocuments())
     72    for (auto* document : Document::allDocuments()) {
    7273        document->clearSelectorQueryCache();
     74
     75#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     76        if (auto* renderView = document->renderView())
     77            LayoutIntegration::LineLayout::releaseCaches(*renderView);
     78#endif
     79    }
    7380
    7481    if (maintainMemoryCache == MaintainMemoryCache::No)
Note: See TracChangeset for help on using the changeset viewer.