Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: third_party/WebKit/Source/core/css/StyleRule.cpp

Issue 2289333003: CSS Lazy Parsing perf jobs (Closed)
Patch Set: CL for src perf tryjob to run blink_style.top_25 benchmark on all-android platform(s) Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 rule->setParentRule(parentRule); 201 rule->setParentRule(parentRule);
202 return rule; 202 return rule;
203 } 203 }
204 204
205 unsigned StyleRule::averageSizeInBytes() { 205 unsigned StyleRule::averageSizeInBytes() {
206 return sizeof(StyleRule) + sizeof(CSSSelector) + 206 return sizeof(StyleRule) + sizeof(CSSSelector) +
207 StylePropertySet::averageSizeInBytes(); 207 StylePropertySet::averageSizeInBytes();
208 } 208 }
209 209
210 StyleRule::StyleRule(CSSSelectorList selectorList, StylePropertySet* properties) 210 StyleRule::StyleRule(CSSSelectorList selectorList, StylePropertySet* properties)
211 : StyleRuleBase(Style), m_properties(properties) { 211 : StyleRuleBase(Style),
212 m_selectorList = std::move(selectorList); 212 m_selectorList(std::move(selectorList)),
213 m_properties(properties) {}
214
215 StyleRule::StyleRule(
216 CSSSelectorList selectorList,
217 std::unique_ptr<DeferredPropertiesClosure> deferredProperties)
218 : StyleRuleBase(Style),
219 m_selectorList(std::move(selectorList)),
220 m_deferred(std::move(deferredProperties)) {}
221
222 const StylePropertySet& StyleRule::properties() const {
223 if (!m_properties) {
224 m_properties = (*m_deferred)();
225 m_deferred.reset();
226 }
227 return *m_properties;
213 } 228 }
214 229
215 StyleRule::StyleRule(const StyleRule& o) 230 StyleRule::StyleRule(const StyleRule& o)
216 : StyleRuleBase(o), 231 : StyleRuleBase(o),
217 m_properties(o.m_properties->mutableCopy()), 232 m_selectorList(o.m_selectorList.copy()),
218 m_selectorList(o.m_selectorList.copy()) {} 233 m_properties(o.properties().mutableCopy()) {}
219 234
220 StyleRule::~StyleRule() {} 235 StyleRule::~StyleRule() {}
221 236
222 MutableStylePropertySet& StyleRule::mutableProperties() { 237 MutableStylePropertySet& StyleRule::mutableProperties() {
223 if (!m_properties->isMutable()) 238 // Ensure m_properties is initialized.
239 if (!properties().isMutable())
224 m_properties = m_properties->mutableCopy(); 240 m_properties = m_properties->mutableCopy();
225 return *toMutableStylePropertySet(m_properties.get()); 241 return *toMutableStylePropertySet(m_properties.get());
226 } 242 }
227 243
244 bool StyleRule::propertiesHaveFailedOrCanceledSubresources() const {
245 return m_properties && m_properties->hasFailedOrCanceledSubresources();
246 }
247
248 bool StyleRule::shouldConsiderForMatchingRules(bool includeEmptyRules) const {
249 // Consider all non-empty property sets if parsing has not been deferred.
250 // Otherwise, consider all StyleRules with non-null deferred closures.
251 return includeEmptyRules || !(m_properties && m_properties->isEmpty());
252 }
253
228 DEFINE_TRACE_AFTER_DISPATCH(StyleRule) { 254 DEFINE_TRACE_AFTER_DISPATCH(StyleRule) {
229 visitor->trace(m_properties); 255 visitor->trace(m_properties);
230 StyleRuleBase::traceAfterDispatch(visitor); 256 StyleRuleBase::traceAfterDispatch(visitor);
231 } 257 }
232 258
233 StyleRulePage::StyleRulePage(CSSSelectorList selectorList, 259 StyleRulePage::StyleRulePage(CSSSelectorList selectorList,
234 StylePropertySet* properties) 260 StylePropertySet* properties)
235 : StyleRuleBase(Page), 261 : StyleRuleBase(Page),
236 m_properties(properties), 262 m_properties(properties),
237 m_selectorList(std::move(selectorList)) {} 263 m_selectorList(std::move(selectorList)) {}
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 m_properties = m_properties->mutableCopy(); 364 m_properties = m_properties->mutableCopy();
339 return *toMutableStylePropertySet(m_properties); 365 return *toMutableStylePropertySet(m_properties);
340 } 366 }
341 367
342 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport) { 368 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport) {
343 visitor->trace(m_properties); 369 visitor->trace(m_properties);
344 StyleRuleBase::traceAfterDispatch(visitor); 370 StyleRuleBase::traceAfterDispatch(visitor);
345 } 371 }
346 372
347 } // namespace blink 373 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleRule.h ('k') | third_party/WebKit/Source/core/css/StyleSheetContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698