Changeset 210224 in webkit
- Timestamp:
- Jan 2, 2017 7:36:41 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r210116 r210224 1 2017-01-02 Andreas Kling <akling@apple.com> 2 3 Discard media controls JS/CSS caches under memory pressure. 4 <https://webkit.org/b/166639> 5 6 Reviewed by Antti Koivisto. 7 8 * wtf/text/WTFString.h: 9 (WTF::String::clearImplIfNotShared): Add a helper for clearing a String if the underlying 10 StringImpl is not referenced by anyone else. 11 1 12 2016-12-22 Mark Lam <mark.lam@apple.com> 2 13 -
trunk/Source/WTF/wtf/text/WTFString.h
r206804 r210224 468 468 return 0; 469 469 return (*m_impl)[index]; 470 } 471 472 // Turns this String empty if the StringImpl is not referenced by anyone else. 473 // This is useful for clearing String-based caches. 474 void clearImplIfNotShared() 475 { 476 if (m_impl && m_impl->hasOneRef()) 477 m_impl = nullptr; 470 478 } 471 479 -
trunk/Source/WebCore/ChangeLog
r210223 r210224 1 2017-01-02 Andreas Kling <akling@apple.com> 2 3 Discard media controls JS/CSS caches under memory pressure. 4 <https://webkit.org/b/166639> 5 6 Reviewed by Antti Koivisto. 7 8 Add a RenderTheme::purgeCaches() virtual and teach the iOS and macOS implementations 9 to drop their cached media controls JS/CSS strings there. The strings are only cleared 10 if nothing else is referencing them, which gives us a decent "weak cache" behavior. 11 12 This sheds ~300kB memory on iOS with the current media controls. 13 14 * page/MemoryRelease.cpp: 15 (WebCore::releaseNoncriticalMemory): 16 * rendering/RenderTheme.h: 17 (WebCore::RenderTheme::purgeCaches): 18 * rendering/RenderThemeIOS.h: 19 * rendering/RenderThemeIOS.mm: 20 (WebCore::RenderThemeIOS::purgeCaches): 21 * rendering/RenderThemeMac.h: 22 * rendering/RenderThemeMac.mm: 23 (WebCore::RenderThemeMac::purgeCaches): 24 1 25 2017-01-02 Carlos Garcia Campos <cgarcia@igalia.com> 2 26 -
trunk/Source/WebCore/page/MemoryRelease.cpp
r209744 r210224 39 39 #include "Page.h" 40 40 #include "PageCache.h" 41 #include "RenderTheme.h" 41 42 #include "ScrollingThread.h" 42 43 #include "StyleScope.h" … … 49 50 static void releaseNoncriticalMemory() 50 51 { 52 RenderTheme::defaultTheme()->purgeCaches(); 53 51 54 FontCache::singleton().purgeInactiveFontData(); 52 55 -
trunk/Source/WebCore/rendering/RenderTheme.h
r208668 r210224 73 73 }; 74 74 75 virtual void purgeCaches() { } 76 75 77 // This method is called whenever style has been computed for an element and the appearance 76 78 // property has been set to a value other than "none". The theme should map in all of the appropriate -
trunk/Source/WebCore/rendering/RenderThemeIOS.h
r209441 r210224 122 122 virtual ~RenderThemeIOS() { } 123 123 124 void purgeCaches() override; 125 124 126 const Color& shadowColor() const; 125 127 FloatRect addRoundedBorderClip(const RenderObject& box, GraphicsContext&, const IntRect&); -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r209441 r210224 1306 1306 } 1307 1307 1308 void RenderThemeIOS::purgeCaches() 1309 { 1310 m_legacyMediaControlsScript.clearImplIfNotShared(); 1311 m_mediaControlsScript.clearImplIfNotShared(); 1312 m_legacyMediaControlsStyleSheet.clearImplIfNotShared(); 1313 m_mediaControlsStyleSheet.clearImplIfNotShared(); 1314 } 1315 1308 1316 String RenderThemeIOS::mediaControlsScript() 1309 1317 { -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r209417 r210224 172 172 173 173 Color systemColor(CSSValueID) const override; 174 175 void purgeCaches() override; 174 176 175 177 // Get the control size based off the font. Used by some of the controls (like buttons). -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r209417 r210224 247 247 } 248 248 249 void RenderThemeMac::purgeCaches() 250 { 251 m_legacyMediaControlsScript.clearImplIfNotShared(); 252 m_mediaControlsScript.clearImplIfNotShared(); 253 m_legacyMediaControlsStyleSheet.clearImplIfNotShared(); 254 m_mediaControlsStyleSheet.clearImplIfNotShared(); 255 } 256 249 257 String RenderThemeMac::mediaControlsScript() 250 258 {
Note: See TracChangeset
for help on using the changeset viewer.