| 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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); | 1338 static int mapCSSPropertyIdToCSSSampleIdForHistogram(CSSPropertyID); |
| 1332 | 1339 |
| 1333 void muteForInspector(); | 1340 void muteForInspector(); |
| 1334 void unmuteForInspector(); | 1341 void unmuteForInspector(); |
| 1335 | 1342 |
| 1336 void recordMeasurement(Feature); | 1343 void recordMeasurement(Feature); |
| 1337 void updateMeasurements(); | 1344 void updateMeasurements(); |
| 1338 | 1345 |
| 1339 bool hasRecordedMeasurement(Feature) const; | 1346 bool hasRecordedMeasurement(Feature) const; |
| 1340 | 1347 |
| 1341 protected: | 1348 private: |
| 1349 EnumerationHistogram& featuresHistogram() const; |
| 1350 EnumerationHistogram& cssHistogram() const; |
| 1351 |
| 1352 unsigned m_muteCount; |
| 1353 Context m_context; |
| 1354 |
| 1355 // Track what features/properties have been reported to the (non-legacy) his
tograms. |
| 1356 BitVector m_featuresRecorded; |
| 1357 BitVector m_CSSRecorded; |
| 1358 |
| 1342 // Encapsulates the work to preserve the old "FeatureObserver" histogram wit
h original semantics | 1359 // Encapsulates the work to preserve the old "FeatureObserver" histogram wit
h original semantics |
| 1343 // TODO(rbyers): remove this - http://crbug.com/597963 | 1360 // TODO(rbyers): remove this - http://crbug.com/597963 |
| 1344 class LegacyCounter { | 1361 class LegacyCounter { |
| 1345 public: | 1362 public: |
| 1346 LegacyCounter(); | 1363 LegacyCounter(); |
| 1347 ~LegacyCounter(); | 1364 ~LegacyCounter(); |
| 1348 void countFeature(Feature); | 1365 void countFeature(Feature); |
| 1349 void countCSS(CSSPropertyID); | 1366 void countCSS(CSSPropertyID); |
| 1350 void updateMeasurements(); | 1367 void updateMeasurements(); |
| 1351 private: | 1368 private: |
| 1352 // Tracks what features/properties need to be reported to the legacy his
tograms. | 1369 // Tracks what features/properties need to be reported to the legacy his
tograms. |
| 1353 BitVector m_featureBits; | 1370 BitVector m_featureBits; |
| 1354 BitVector m_CSSBits; | 1371 BitVector m_CSSBits; |
| 1355 } m_legacyCounter; | 1372 } m_legacyCounter; |
| 1356 | |
| 1357 unsigned m_muteCount; | |
| 1358 | |
| 1359 // Track what features/properties have been reported to the (non-legacy) his
tograms. | |
| 1360 BitVector m_featuresRecorded; | |
| 1361 BitVector m_CSSRecorded; | |
| 1362 }; | 1373 }; |
| 1363 | 1374 |
| 1364 } // namespace blink | 1375 } // namespace blink |
| 1365 | 1376 |
| 1366 #endif // UseCounter_h | 1377 #endif // UseCounter_h |
| OLD | NEW |