Changeset 204006 in webkit
- Timestamp:
- Aug 1, 2016 6:44:43 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r204005 r204006 1 2016-08-01 Andreas Kling <akling@apple.com> 2 3 Shrink MediaQuerySets to fit after parsing. 4 <https://webkit.org/b/160419> 5 6 Reviewed by Antti Koivisto. 7 8 Add shrinkToFit() helpers to MediaQuerySet and MediaQuery 9 and call it after parsing to remove extra capacity from their 10 internal vectors. 11 12 This reduces memory usage by 1.24MB on theverge.com. 13 14 * css/CSSParser.cpp: 15 (WebCore::CSSParser::createMediaRule): 16 * css/MediaList.cpp: 17 (WebCore::MediaQuerySet::parse): 18 (WebCore::MediaQuerySet::shrinkToFit): 19 * css/MediaList.h: 20 * css/MediaQuery.h: 21 (WebCore::MediaQuery::shrinkToFit): 22 1 23 2016-08-01 Tim Horton <timothy_horton@apple.com> 2 24 -
trunk/Source/WebCore/css/CSSParser.cpp
r203717 r204006 12906 12906 // even when it is syntactically incorrect. 12907 12907 rule = StyleRuleMedia::create(MediaQuerySet::create(), emptyRules); 12908 } else 12908 } else { 12909 media->shrinkToFit(); 12909 12910 rule = StyleRuleMedia::create(media.releaseNonNull(), rules ? *rules : emptyRules); 12911 } 12910 12912 processAndAddNewRuleToSourceTreeIfNeeded(); 12911 12913 return rule.releaseNonNull(); -
trunk/Source/WebCore/css/MediaList.cpp
r201441 r204006 159 159 } 160 160 m_queries = WTFMove(result); 161 shrinkToFit(); 161 162 return true; 162 163 } … … 197 198 } 198 199 return text.toString(); 200 } 201 202 void MediaQuerySet::shrinkToFit() 203 { 204 m_queries.shrinkToFit(); 205 for (auto& query : m_queries) 206 query.shrinkToFit(); 199 207 } 200 208 -
trunk/Source/WebCore/css/MediaList.h
r201441 r204006 67 67 Ref<MediaQuerySet> copy() const { return adoptRef(*new MediaQuerySet(*this)); } 68 68 69 void shrinkToFit(); 70 69 71 private: 70 72 MediaQuerySet(); -
trunk/Source/WebCore/css/MediaQuery.h
r201441 r204006 50 50 bool operator==(const MediaQuery& other) const; 51 51 52 void shrinkToFit() { m_expressions.shrinkToFit(); } 53 52 54 private: 53 55 String serialize() const;
Note: See TracChangeset
for help on using the changeset viewer.