| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/css/parser/CSSParserMode.h" | 31 #include "core/css/parser/CSSParserMode.h" |
| 32 #include "wtf/BitVector.h" | 32 #include "wtf/BitVector.h" |
| 33 #include "wtf/Noncopyable.h" | 33 #include "wtf/Noncopyable.h" |
| 34 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
| 35 #include <v8.h> | 35 #include <v8.h> |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class CSSStyleSheet; | 39 class CSSStyleSheet; |
| 40 class Document; | 40 class Document; |
| 41 class EnumerationHistogram; |
| 41 class ExecutionContext; | 42 class ExecutionContext; |
| 42 class Frame; | 43 class Frame; |
| 43 class LocalFrame; | 44 class LocalFrame; |
| 44 class StyleSheetContents; | 45 class StyleSheetContents; |
| 45 | 46 |
| 46 // UseCounter is used for counting the number of times features of | 47 // UseCounter is used for counting the number of times features of |
| 47 // Blink are used on real web pages and help us know commonly | 48 // Blink are used on real web pages and help us know commonly |
| 48 // features are used and thus when it's safe to remove or change them. | 49 // features are used and thus when it's safe to remove or change them. |
| 49 // | 50 // |
| 50 // The Chromium Content layer controls what is done with this data. | 51 // The Chromium Content layer controls what is done with this data. |
| 51 // For instance, in Google Chrome, these counts are submitted | 52 // For instance, in Google Chrome, these counts are submitted |
| 52 // anonymously through the Histogram recording system in Chrome | 53 // anonymously through the Histogram recording system in Chrome |
| 53 // for users who opt-in to "Usage Statistics" submission | 54 // for users who opt-in to "Usage Statistics" submission |
| 54 // during their install of Google Chrome: | 55 // during their install of Google Chrome: |
| 55 // http://www.google.com/chrome/intl/en/privacy.html | 56 // http://www.google.com/chrome/intl/en/privacy.html |
| 56 | 57 |
| 57 class CORE_EXPORT UseCounter { | 58 class CORE_EXPORT UseCounter { |
| 58 DISALLOW_NEW(); | 59 DISALLOW_NEW(); |
| 59 WTF_MAKE_NONCOPYABLE(UseCounter); | 60 WTF_MAKE_NONCOPYABLE(UseCounter); |
| 60 public: | 61 public: |
| 61 UseCounter(); | 62 enum Context { |
| 63 DefaultContext, |
| 64 // Counters for SVGImages (lifetime independent from other pages). |
| 65 SVGImageContext |
| 66 }; |
| 67 |
| 68 UseCounter(Context = DefaultContext); |
| 62 | 69 |
| 63 enum Feature { | 70 enum Feature { |
| 64 // Do not change assigned numbers of existing items: add new features | 71 // Do not change assigned numbers of existing items: add new features |
| 65 // to the end of the list. | 72 // to the end of the list. |
| 66 OBSOLETE_PageDestruction = 0, | 73 OBSOLETE_PageDestruction = 0, |
| 67 PrefixedIndexedDB = 3, | 74 PrefixedIndexedDB = 3, |
| 68 WorkerStart = 4, | 75 WorkerStart = 4, |
| 69 SharedWorkerStart = 5, | 76 SharedWorkerStart = 5, |
| 70 UnprefixedIndexedDB = 9, | 77 UnprefixedIndexedDB = 9, |
| 71 OpenWebDatabase = 10, | 78 OpenWebDatabase = 10, |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); | 1336 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); |
| 1330 | 1337 |
| 1331 void muteForInspector(); | 1338 void muteForInspector(); |
| 1332 void unmuteForInspector(); | 1339 void unmuteForInspector(); |
| 1333 | 1340 |
| 1334 void recordMeasurement(Feature); | 1341 void recordMeasurement(Feature); |
| 1335 void updateMeasurements(); | 1342 void updateMeasurements(); |
| 1336 | 1343 |
| 1337 bool hasRecordedMeasurement(Feature) const; | 1344 bool hasRecordedMeasurement(Feature) const; |
| 1338 | 1345 |
| 1339 protected: | 1346 private: |
| 1347 EnumerationHistogram& featuresHistogram() const; |
| 1348 EnumerationHistogram& cssHistogram() const; |
| 1349 |
| 1350 unsigned m_muteCount; |
| 1351 Context m_context; |
| 1352 |
| 1353 // Track what features/properties have been reported to the (non-legacy) his
tograms. |
| 1354 BitVector m_featuresRecorded; |
| 1355 BitVector m_CSSRecorded; |
| 1356 |
| 1340 // Encapsulates the work to preserve the old "FeatureObserver" histogram wit
h original semantics | 1357 // Encapsulates the work to preserve the old "FeatureObserver" histogram wit
h original semantics |
| 1341 // TODO(rbyers): remove this - http://crbug.com/597963 | 1358 // TODO(rbyers): remove this - http://crbug.com/597963 |
| 1342 class LegacyCounter { | 1359 class LegacyCounter { |
| 1343 public: | 1360 public: |
| 1344 LegacyCounter(); | 1361 LegacyCounter(); |
| 1345 ~LegacyCounter(); | 1362 ~LegacyCounter(); |
| 1346 void countFeature(Feature); | 1363 void countFeature(Feature); |
| 1347 void countCSS(CSSPropertyID); | 1364 void countCSS(CSSPropertyID); |
| 1348 void updateMeasurements(); | 1365 void updateMeasurements(); |
| 1349 private: | 1366 private: |
| 1350 // Tracks what features/properties need to be reported to the legacy his
tograms. | 1367 // Tracks what features/properties need to be reported to the legacy his
tograms. |
| 1351 BitVector m_featureBits; | 1368 BitVector m_featureBits; |
| 1352 BitVector m_CSSBits; | 1369 BitVector m_CSSBits; |
| 1353 } m_legacyCounter; | 1370 } m_legacyCounter; |
| 1354 | |
| 1355 unsigned m_muteCount; | |
| 1356 | |
| 1357 // Track what features/properties have been reported to the (non-legacy) his
tograms. | |
| 1358 BitVector m_featuresRecorded; | |
| 1359 BitVector m_CSSRecorded; | |
| 1360 }; | 1371 }; |
| 1361 | 1372 |
| 1362 } // namespace blink | 1373 } // namespace blink |
| 1363 | 1374 |
| 1364 #endif // UseCounter_h | 1375 #endif // UseCounter_h |
| OLD | NEW |