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

Side by Side Diff: third_party/WebKit/Source/core/frame/UseCounter.cpp

Issue 2671173002: Change CSSParserContext to have a Document handle (vs UseCounter). (Closed)
Patch Set: fix todo style Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google, Inc. All rights reserved. 2 * Copyright (C) 2012 Google, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 m_CSSRecorded.quickSet(property); 1243 m_CSSRecorded.quickSet(property);
1244 } 1244 }
1245 m_legacyCounter.countCSS(property); 1245 m_legacyCounter.countCSS(property);
1246 } 1246 }
1247 1247
1248 void UseCounter::count(Feature feature) { 1248 void UseCounter::count(Feature feature) {
1249 DCHECK(Deprecation::deprecationMessage(feature).isEmpty()); 1249 DCHECK(Deprecation::deprecationMessage(feature).isEmpty());
1250 recordMeasurement(feature); 1250 recordMeasurement(feature);
1251 } 1251 }
1252 1252
1253 UseCounter* UseCounter::getFrom(const Document* document) {
1254 if (document && document->frameHost())
1255 return &document->frameHost()->useCounter();
1256 return 0;
1257 }
1258
1259 UseCounter* UseCounter::getFrom(const CSSStyleSheet* sheet) {
1260 if (sheet)
1261 return getFrom(sheet->contents());
1262 return 0;
1263 }
1264
1265 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) {
1266 // FIXME: We may want to handle stylesheets that have multiple owners
1267 // https://crbug.com/242125
1268 if (sheetContents && sheetContents->hasSingleOwnerNode())
1269 return getFrom(sheetContents->singleOwnerDocument());
1270 return 0;
1271 }
1272
1273 EnumerationHistogram& UseCounter::featuresHistogram() const { 1253 EnumerationHistogram& UseCounter::featuresHistogram() const {
1274 // Every SVGImage has it's own Page instance, and multiple web pages can 1254 // Every SVGImage has it's own Page instance, and multiple web pages can
1275 // share the usage of a single SVGImage. Ideally perhaps we'd delegate 1255 // share the usage of a single SVGImage. Ideally perhaps we'd delegate
1276 // metrics from an SVGImage to one of the Page's it's displayed in, but 1256 // metrics from an SVGImage to one of the Page's it's displayed in, but
1277 // that's tricky (SVGImage is intentionally isolated, and the Page that 1257 // that's tricky (SVGImage is intentionally isolated, and the Page that
1278 // created it may not even exist anymore). 1258 // created it may not even exist anymore).
1279 // So instead we just use a dedicated histogram for the SVG case. 1259 // So instead we just use a dedicated histogram for the SVG case.
1280 DEFINE_STATIC_LOCAL( 1260 DEFINE_STATIC_LOCAL(
1281 blink::EnumerationHistogram, histogram, 1261 blink::EnumerationHistogram, histogram,
1282 ("Blink.UseCounter.Features", blink::UseCounter::NumberOfFeatures)); 1262 ("Blink.UseCounter.Features", blink::UseCounter::NumberOfFeatures));
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 } 1336 }
1357 } 1337 }
1358 1338
1359 if (needsPagesMeasuredUpdate) 1339 if (needsPagesMeasuredUpdate)
1360 cssPropertiesHistogram.count(totalPagesMeasuredCSSSampleId()); 1340 cssPropertiesHistogram.count(totalPagesMeasuredCSSSampleId());
1361 1341
1362 m_CSSBits.clearAll(); 1342 m_CSSBits.clearAll();
1363 } 1343 }
1364 1344
1365 } // namespace blink 1345 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698