| OLD | NEW |
| 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 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef UseCounter_h | 26 #ifndef UseCounter_h |
| 27 #define UseCounter_h | 27 #define UseCounter_h |
| 28 | 28 |
| 29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/css/parser/CSSParserMode.h" | 31 #include "core/css/parser/CSSParserMode.h" |
| 32 #include "platform/weborigin/KURL.h" |
| 32 #include "wtf/BitVector.h" | 33 #include "wtf/BitVector.h" |
| 33 #include "wtf/Noncopyable.h" | 34 #include "wtf/Noncopyable.h" |
| 34 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
| 35 #include <v8.h> | 36 #include <v8.h> |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 class CSSStyleSheet; | 40 class CSSStyleSheet; |
| 40 class Document; | 41 class Document; |
| 41 class EnumerationHistogram; | 42 class EnumerationHistogram; |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1421 static void countCrossOriginIframe(const Document&, Feature); | 1422 static void countCrossOriginIframe(const Document&, Feature); |
| 1422 | 1423 |
| 1423 // Return whether the Feature was previously counted for this document. | 1424 // Return whether the Feature was previously counted for this document. |
| 1424 // NOTE: only for use in testing. | 1425 // NOTE: only for use in testing. |
| 1425 static bool isCounted(Document&, Feature); | 1426 static bool isCounted(Document&, Feature); |
| 1426 // Return whether the CSSPropertyID was previously counted for this document. | 1427 // Return whether the CSSPropertyID was previously counted for this document. |
| 1427 // NOTE: only for use in testing. | 1428 // NOTE: only for use in testing. |
| 1428 static bool isCounted(Document&, const String&); | 1429 static bool isCounted(Document&, const String&); |
| 1429 bool isCounted(CSSPropertyID unresolvedProperty); | 1430 bool isCounted(CSSPropertyID unresolvedProperty); |
| 1430 | 1431 |
| 1431 void didCommitLoad(); | 1432 void didCommitLoad(KURL); |
| 1432 | 1433 |
| 1433 static UseCounter* getFrom(const Document*); | 1434 static UseCounter* getFrom(const Document*); |
| 1434 static UseCounter* getFrom(const CSSStyleSheet*); | 1435 static UseCounter* getFrom(const CSSStyleSheet*); |
| 1435 static UseCounter* getFrom(const StyleSheetContents*); | 1436 static UseCounter* getFrom(const StyleSheetContents*); |
| 1436 | 1437 |
| 1437 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); | 1438 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); |
| 1438 | 1439 |
| 1439 void muteForInspector(); | 1440 void muteForInspector(); |
| 1440 void unmuteForInspector(); | 1441 void unmuteForInspector(); |
| 1441 | 1442 |
| 1442 void recordMeasurement(Feature); | 1443 void recordMeasurement(Feature); |
| 1443 void updateMeasurements(); | 1444 void updateMeasurements(); |
| 1444 | 1445 |
| 1445 bool hasRecordedMeasurement(Feature) const; | 1446 bool hasRecordedMeasurement(Feature) const; |
| 1446 | 1447 |
| 1447 private: | 1448 private: |
| 1448 EnumerationHistogram& featuresHistogram() const; | 1449 EnumerationHistogram& featuresHistogram() const; |
| 1449 EnumerationHistogram& cssHistogram() const; | 1450 EnumerationHistogram& cssHistogram() const; |
| 1450 | 1451 |
| 1451 unsigned m_muteCount; | 1452 unsigned m_muteCount; |
| 1453 bool m_mutedByLoad; |
| 1452 Context m_context; | 1454 Context m_context; |
| 1453 | 1455 |
| 1454 // Track what features/properties have been reported to the (non-legacy) | 1456 // Track what features/properties have been reported to the (non-legacy) |
| 1455 // histograms. | 1457 // histograms. |
| 1456 BitVector m_featuresRecorded; | 1458 BitVector m_featuresRecorded; |
| 1457 BitVector m_CSSRecorded; | 1459 BitVector m_CSSRecorded; |
| 1458 | 1460 |
| 1459 // Encapsulates the work to preserve the old "FeatureObserver" histogram with | 1461 // Encapsulates the work to preserve the old "FeatureObserver" histogram with |
| 1460 // original semantics | 1462 // original semantics |
| 1461 // TODO(rbyers): remove this - http://crbug.com/597963 | 1463 // TODO(rbyers): remove this - http://crbug.com/597963 |
| 1462 class CORE_EXPORT LegacyCounter { | 1464 class CORE_EXPORT LegacyCounter { |
| 1463 public: | 1465 public: |
| 1464 LegacyCounter(); | 1466 LegacyCounter(); |
| 1465 ~LegacyCounter(); | 1467 ~LegacyCounter(); |
| 1466 void countFeature(Feature); | 1468 void countFeature(Feature); |
| 1467 void countCSS(CSSPropertyID); | 1469 void countCSS(CSSPropertyID); |
| 1468 void updateMeasurements(); | 1470 void updateMeasurements(); |
| 1469 | 1471 |
| 1470 private: | 1472 private: |
| 1471 // Tracks what features/properties need to be reported to the legacy | 1473 // Tracks what features/properties need to be reported to the legacy |
| 1472 // histograms. | 1474 // histograms. |
| 1473 BitVector m_featureBits; | 1475 BitVector m_featureBits; |
| 1474 BitVector m_CSSBits; | 1476 BitVector m_CSSBits; |
| 1475 } m_legacyCounter; | 1477 } m_legacyCounter; |
| 1476 }; | 1478 }; |
| 1477 | 1479 |
| 1478 } // namespace blink | 1480 } // namespace blink |
| 1479 | 1481 |
| 1480 #endif // UseCounter_h | 1482 #endif // UseCounter_h |
| OLD | NEW |