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

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

Issue 2671173002: Change CSSParserContext to have a Document handle (vs UseCounter). (Closed)
Patch Set: fix trace and import 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
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 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 CSSValueOnDemand = 1802, 1455 CSSValueOnDemand = 1802,
1456 ServiceWorkerNavigationPreload = 1803, 1456 ServiceWorkerNavigationPreload = 1803,
1457 1457
1458 // Add new features immediately above this line. Don't change assigned 1458 // Add new features immediately above this line. Don't change assigned
1459 // numbers of any item, and don't reuse removed slots. 1459 // numbers of any item, and don't reuse removed slots.
1460 // Also, run update_use_counter_feature_enum.py in 1460 // Also, run update_use_counter_feature_enum.py in
1461 // chromium/src/tools/metrics/histograms/ to update the UMA mapping. 1461 // chromium/src/tools/metrics/histograms/ to update the UMA mapping.
1462 NumberOfFeatures, // This enum value must be last. 1462 NumberOfFeatures, // This enum value must be last.
1463 }; 1463 };
1464 1464
1465 static const Document* singleOwnerDocument(const StyleSheetContents*);
1466 static const Document* singleOwnerDocument(const CSSStyleSheet*);
haraken 2017/02/08 01:40:00 I'd move these methods to StyleSheetContents (or s
Bret 2017/02/09 01:53:33 Done. I moved these into their own class files (St
1467
1465 // "count" sets the bit for this feature to 1. Repeated calls are ignored. 1468 // "count" sets the bit for this feature to 1. Repeated calls are ignored.
1466 static void count(const Frame*, Feature); 1469 static void count(const Frame*, Feature);
1467 static void count(const Document&, Feature); 1470 static void count(const Document&, Feature);
1468 static void count(ExecutionContext*, Feature); 1471 static void count(ExecutionContext*, Feature);
1469 1472
1470 void count(CSSParserMode, CSSPropertyID); 1473 void count(CSSParserMode, CSSPropertyID);
1471 void count(Feature); 1474 void count(Feature);
1472 1475
1473 // Count only features if they're being used in an iframe which does not 1476 // Count only features if they're being used in an iframe which does not
1474 // have script access into the top level document. 1477 // have script access into the top level document.
1475 static void countCrossOriginIframe(const Document&, Feature); 1478 static void countCrossOriginIframe(const Document&, Feature);
1476 1479
1477 // Return whether the Feature was previously counted for this document. 1480 // Return whether the Feature was previously counted for this document.
1478 // NOTE: only for use in testing. 1481 // NOTE: only for use in testing.
1479 static bool isCounted(Document&, Feature); 1482 static bool isCounted(Document&, Feature);
1480 // Return whether the CSSPropertyID was previously counted for this document. 1483 // Return whether the CSSPropertyID was previously counted for this document.
1481 // NOTE: only for use in testing. 1484 // NOTE: only for use in testing.
1482 static bool isCounted(Document&, const String&); 1485 static bool isCounted(Document&, const String&);
1483 bool isCounted(CSSPropertyID unresolvedProperty); 1486 bool isCounted(CSSPropertyID unresolvedProperty);
1484 1487
1485 // Invoked when a new document is loaded into the main frame of the page. 1488 // Invoked when a new document is loaded into the main frame of the page.
1486 void didCommitLoad(KURL); 1489 void didCommitLoad(KURL);
1487 1490
1488 static UseCounter* getFrom(const Document*);
1489 static UseCounter* getFrom(const CSSStyleSheet*);
1490 static UseCounter* getFrom(const StyleSheetContents*);
1491
1492 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); 1491 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID);
1493 1492
1494 // When muted, all calls to "count" functions are ignoed. May be nested. 1493 // When muted, all calls to "count" functions are ignoed. May be nested.
1495 void muteForInspector(); 1494 void muteForInspector();
1496 void unmuteForInspector(); 1495 void unmuteForInspector();
1497 1496
1498 void recordMeasurement(Feature); 1497 void recordMeasurement(Feature);
1499 1498
1500 // Return whether the feature has been seen since the last page load 1499 // Return whether the feature has been seen since the last page load
1501 // (except when muted). Does include features seen in documents which have 1500 // (except when muted). Does include features seen in documents which have
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 // Tracks what features/properties need to be reported to the legacy 1534 // Tracks what features/properties need to be reported to the legacy
1536 // histograms. 1535 // histograms.
1537 BitVector m_featureBits; 1536 BitVector m_featureBits;
1538 BitVector m_CSSBits; 1537 BitVector m_CSSBits;
1539 } m_legacyCounter; 1538 } m_legacyCounter;
1540 }; 1539 };
1541 1540
1542 } // namespace blink 1541 } // namespace blink
1543 1542
1544 #endif // UseCounter_h 1543 #endif // UseCounter_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698