Home | History | Annotate | Download | only in frame
      1 /*
      2  * Copyright (C) 2012 Google, Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  * 1. Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  * 2. Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
     14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
     17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
     21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     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.
     24  */
     25 
     26 #ifndef UseCounter_h
     27 #define UseCounter_h
     28 
     29 #include "core/CSSPropertyNames.h"
     30 #include "wtf/BitVector.h"
     31 #include "wtf/Noncopyable.h"
     32 #include "wtf/OwnPtr.h"
     33 #include "wtf/PassOwnPtr.h"
     34 #include "wtf/text/WTFString.h"
     35 
     36 namespace WebCore {
     37 
     38 class CSSStyleSheet;
     39 class LocalDOMWindow;
     40 class Document;
     41 class ExecutionContext;
     42 class StyleSheetContents;
     43 
     44 // UseCounter is used for counting the number of times features of
     45 // Blink are used on real web pages and help us know commonly
     46 // features are used and thus when it's safe to remove or change them.
     47 //
     48 // The Chromium Content layer controls what is done with this data.
     49 // For instance, in Google Chrome, these counts are submitted
     50 // anonymously through the Histogram recording system in Chrome
     51 // for users who opt-in to "Usage Statistics" submission
     52 // during their install of Google Chrome:
     53 // http://www.google.com/chrome/intl/en/privacy.html
     54 
     55 class UseCounter {
     56     WTF_MAKE_NONCOPYABLE(UseCounter);
     57 public:
     58     UseCounter();
     59     ~UseCounter();
     60 
     61     enum Feature {
     62         // Do not change assigned numbers of existing items: add new features
     63         // to the end of the list.
     64         PageDestruction = 0,
     65         PrefixedIndexedDB = 3,
     66         WorkerStart = 4,
     67         SharedWorkerStart = 5,
     68         UnprefixedIndexedDB = 9,
     69         OpenWebDatabase = 10,
     70         UnprefixedRequestAnimationFrame = 13,
     71         PrefixedRequestAnimationFrame = 14,
     72         ContentSecurityPolicy = 15,
     73         ContentSecurityPolicyReportOnly = 16,
     74         PrefixedTransitionEndEvent = 18,
     75         UnprefixedTransitionEndEvent = 19,
     76         PrefixedAndUnprefixedTransitionEndEvent = 20,
     77         AutoFocusAttribute = 21,
     78         DataListElement = 23,
     79         FormAttribute = 24,
     80         IncrementalAttribute = 25,
     81         InputTypeColor = 26,
     82         InputTypeDate = 27,
     83         InputTypeDateTimeFallback = 29,
     84         InputTypeDateTimeLocal = 30,
     85         InputTypeEmail = 31,
     86         InputTypeMonth = 32,
     87         InputTypeNumber = 33,
     88         InputTypeRange = 34,
     89         InputTypeSearch = 35,
     90         InputTypeTel = 36,
     91         InputTypeTime = 37,
     92         InputTypeURL = 38,
     93         InputTypeWeek = 39,
     94         InputTypeWeekFallback = 40,
     95         ListAttribute = 41,
     96         MaxAttribute = 42,
     97         MinAttribute = 43,
     98         PatternAttribute = 44,
     99         PlaceholderAttribute = 45,
    100         PrefixedDirectoryAttribute = 47,
    101         RequiredAttribute = 49,
    102         ResultsAttribute = 50,
    103         StepAttribute = 51,
    104         PageVisits = 52,
    105         HTMLMarqueeElement = 53,
    106         Reflection = 55,
    107         PrefixedStorageInfo = 57,
    108         XFrameOptions = 58,
    109         XFrameOptionsSameOrigin = 59,
    110         XFrameOptionsSameOriginWithBadAncestorChain = 60,
    111         DeprecatedFlexboxWebContent = 61,
    112         DeprecatedFlexboxChrome = 62,
    113         DeprecatedFlexboxChromeExtension = 63,
    114         UnprefixedPerformanceTimeline = 65,
    115         UnprefixedUserTiming = 67,
    116         WindowEvent = 69,
    117         ContentSecurityPolicyWithBaseElement = 70,
    118         PrefixedMediaAddKey = 71,
    119         PrefixedMediaGenerateKeyRequest = 72,
    120         DocumentClear = 74,
    121         SVGFontElement = 76,
    122         XMLDocument = 77,
    123         XSLProcessingInstruction = 78,
    124         XSLTProcessor = 79,
    125         SVGSwitchElement = 80,
    126         DocumentAll = 83,
    127         FormElement = 84,
    128         DemotedFormElement = 85,
    129         SVGAnimationElement = 90,
    130         KeyboardEventKeyLocation = 91,
    131         LineClamp = 96,
    132         SubFrameBeforeUnloadRegistered = 97,
    133         SubFrameBeforeUnloadFired = 98,
    134         TextReplaceWholeText = 100,
    135         ConsoleMarkTimeline = 102,
    136         CSSPseudoElementUserAgentCustomPseudo = 103,
    137         ElementGetAttributeNode = 107, // Removed from DOM4.
    138         ElementSetAttributeNode = 108, // Removed from DOM4.
    139         ElementRemoveAttributeNode = 109, // Removed from DOM4.
    140         ElementGetAttributeNodeNS = 110, // Removed from DOM4.
    141         DocumentCreateAttribute = 111, // Removed from DOM4.
    142         DocumentCreateAttributeNS = 112, // Removed from DOM4.
    143         DocumentCreateCDATASection = 113, // Removed from DOM4.
    144         DocumentInputEncoding = 114, // Removed from DOM4.
    145         DocumentXMLEncoding = 115, // Removed from DOM4.
    146         DocumentXMLStandalone = 116, // Removed from DOM4.
    147         DocumentXMLVersion = 117, // Removed from DOM4.
    148         NodeIsSameNode = 118, // Removed from DOM4.
    149         NodeNamespaceURI = 120, // Removed from DOM4.
    150         NodeLocalName = 122, // Removed from DOM4.
    151         NavigatorProductSub = 123,
    152         NavigatorVendor = 124,
    153         NavigatorVendorSub = 125,
    154         FileError = 126,
    155         DocumentCharset = 127, // Documented as IE extensions = 0, from KHTML days.
    156         PrefixedAnimationEndEvent = 128,
    157         UnprefixedAnimationEndEvent = 129,
    158         PrefixedAndUnprefixedAnimationEndEvent = 130,
    159         PrefixedAnimationStartEvent = 131,
    160         UnprefixedAnimationStartEvent = 132,
    161         PrefixedAndUnprefixedAnimationStartEvent = 133,
    162         PrefixedAnimationIterationEvent = 134,
    163         UnprefixedAnimationIterationEvent = 135,
    164         PrefixedAndUnprefixedAnimationIterationEvent = 136,
    165         EventReturnValue = 137, // Legacy IE extension.
    166         SVGSVGElement = 138,
    167         InsertAdjacentText = 140,
    168         InsertAdjacentElement = 141,
    169         HasAttributes = 142, // Removed from DOM4.
    170         DOMSubtreeModifiedEvent = 143,
    171         DOMNodeInsertedEvent = 144,
    172         DOMNodeRemovedEvent = 145,
    173         DOMNodeRemovedFromDocumentEvent = 146,
    174         DOMNodeInsertedIntoDocumentEvent = 147,
    175         DOMCharacterDataModifiedEvent = 148,
    176         DocumentAllLegacyCall = 150,
    177         HTMLAppletElementLegacyCall = 151,
    178         HTMLEmbedElementLegacyCall = 152,
    179         HTMLObjectElementLegacyCall = 153,
    180         GetMatchedCSSRules = 155,
    181         SVGFontInCSS = 156,
    182         AttributeOwnerElement = 160, // Removed in DOM4.
    183         AttributeSpecified = 162, // Removed in DOM4.
    184         PrefixedAudioDecodedByteCount = 164,
    185         PrefixedVideoDecodedByteCount = 165,
    186         PrefixedVideoSupportsFullscreen = 166,
    187         PrefixedVideoDisplayingFullscreen = 167,
    188         PrefixedVideoEnterFullscreen = 168,
    189         PrefixedVideoExitFullscreen = 169,
    190         PrefixedVideoEnterFullScreen = 170,
    191         PrefixedVideoExitFullScreen = 171,
    192         PrefixedVideoDecodedFrameCount = 172,
    193         PrefixedVideoDroppedFrameCount = 173,
    194         PrefixedElementRequestFullscreen = 176,
    195         PrefixedElementRequestFullScreen = 177,
    196         BarPropLocationbar = 178,
    197         BarPropMenubar = 179,
    198         BarPropPersonalbar = 180,
    199         BarPropScrollbars = 181,
    200         BarPropStatusbar = 182,
    201         BarPropToolbar = 183,
    202         InputTypeEmailMultiple = 184,
    203         InputTypeEmailMaxLength = 185,
    204         InputTypeEmailMultipleMaxLength = 186,
    205         InputTypeText = 190,
    206         InputTypeTextMaxLength = 191,
    207         InputTypePassword = 192,
    208         InputTypePasswordMaxLength = 193,
    209         SVGInstanceRoot = 194,
    210         ShowModalDialog = 195,
    211         PrefixedPageVisibility = 196,
    212         CSSStyleSheetInsertRuleOptionalArg = 198, // Inconsistent with the specification and other browsers.
    213         DocumentBeforeUnloadRegistered = 200,
    214         DocumentBeforeUnloadFired = 201,
    215         DocumentUnloadRegistered = 202,
    216         DocumentUnloadFired = 203,
    217         SVGLocatableNearestViewportElement = 204,
    218         SVGLocatableFarthestViewportElement = 205,
    219         HTMLHeadElementProfile = 207,
    220         OverflowChangedEvent = 208,
    221         SVGPointMatrixTransform = 209,
    222         DOMFocusInOutEvent = 211,
    223         FileGetLastModifiedDate = 212,
    224         HTMLElementInnerText = 213,
    225         HTMLElementOuterText = 214,
    226         ReplaceDocumentViaJavaScriptURL = 215,
    227         ElementSetAttributeNodeNS = 216, // Removed from DOM4.
    228         ElementPrefixedMatchesSelector = 217,
    229         CSSStyleSheetRules = 219,
    230         CSSStyleSheetAddRule = 220,
    231         CSSStyleSheetRemoveRule = 221,
    232         // The above items are available in M33 branch.
    233 
    234         InitMessageEvent = 222,
    235         ElementSetPrefix = 224, // Element.prefix is readonly in DOM4.
    236         CSSStyleDeclarationGetPropertyCSSValue = 225,
    237         PrefixedMediaCancelKeyRequest = 229,
    238         DOMImplementationHasFeature = 230,
    239         DOMImplementationHasFeatureReturnFalse = 231,
    240         CanPlayTypeKeySystem = 232,
    241         PrefixedDevicePixelRatioMediaFeature = 233,
    242         PrefixedMaxDevicePixelRatioMediaFeature = 234,
    243         PrefixedMinDevicePixelRatioMediaFeature = 235,
    244         PrefixedTransform3dMediaFeature = 237,
    245         PrefixedStorageQuota = 240,
    246         ContentSecurityPolicyReportOnlyInMeta = 241,
    247         ResetReferrerPolicy = 243,
    248         CaseInsensitiveAttrSelectorMatch = 244, // Case-insensitivity dropped from specification.
    249         FormNameAccessForImageElement = 246,
    250         FormNameAccessForPastNamesMap = 247,
    251         FormAssociationByParser = 248,
    252         SVGSVGElementInDocument = 250,
    253         SVGDocumentRootElement = 251,
    254         MediaErrorEncrypted = 253,
    255         EventSourceURL = 254,
    256         WebSocketURL = 255,
    257         WorkerSubjectToCSP = 257,
    258         WorkerAllowedByChildBlockedByScript = 258,
    259         DeprecatedWebKitGradient = 260,
    260         DeprecatedWebKitLinearGradient = 261,
    261         DeprecatedWebKitRepeatingLinearGradient = 262,
    262         DeprecatedWebKitRadialGradient = 263,
    263         DeprecatedWebKitRepeatingRadialGradient = 264,
    264         PrefixedImageSmoothingEnabled = 267,
    265         UnprefixedImageSmoothingEnabled = 268,
    266         PromiseConstructor = 270,
    267         PromiseCast = 271,
    268         PromiseReject = 272,
    269         PromiseResolve = 273,
    270         // The above items are available in M34 branch.
    271 
    272         TextAutosizing = 274,
    273         TextAutosizingLayout = 275,
    274         HTMLAnchorElementPingAttribute = 276,
    275         InsertAdjacentHTML = 278,
    276         SVGClassName = 279,
    277         HTMLAppletElement = 280,
    278         HTMLMediaElementSeekToFragmentStart = 281,
    279         HTMLMediaElementPauseAtFragmentEnd = 282,
    280         PrefixedWindowURL = 283,
    281         PrefixedWorkerURL = 284, // This didn't work because of crbug.com/376039. Available since M37.
    282         WindowOrientation = 285,
    283         DOMStringListContains = 286,
    284         DocumentCaptureEvents = 287,
    285         DocumentReleaseEvents = 288,
    286         WindowCaptureEvents = 289,
    287         WindowReleaseEvents = 290,
    288         PrefixedGamepad = 291,
    289         ElementAnimateKeyframeListEffectObjectTiming = 292,
    290         ElementAnimateKeyframeListEffectDoubleTiming = 293,
    291         ElementAnimateKeyframeListEffectNoTiming = 294,
    292         DocumentXPathCreateExpression = 295,
    293         DocumentXPathCreateNSResolver = 296,
    294         DocumentXPathEvaluate = 297,
    295         AttrGetValue = 298,
    296         AttrSetValue = 299,
    297         AnimationConstructorKeyframeListEffectObjectTiming = 300,
    298         AnimationConstructorKeyframeListEffectDoubleTiming = 301,
    299         AnimationConstructorKeyframeListEffectNoTiming = 302,
    300         AttrSetValueWithElement = 303,
    301         PrefixedCancelAnimationFrame = 304,
    302         PrefixedCancelRequestAnimationFrame = 305,
    303         NamedNodeMapGetNamedItem = 306,
    304         NamedNodeMapSetNamedItem = 307,
    305         NamedNodeMapRemoveNamedItem = 308,
    306         NamedNodeMapItem = 309,
    307         NamedNodeMapGetNamedItemNS = 310,
    308         NamedNodeMapSetNamedItemNS = 311,
    309         NamedNodeMapRemoveNamedItemNS = 312,
    310         OpenWebDatabaseInWorker = 313, // This didn't work because of crbug.com/376039. Available since M37.
    311         OpenWebDatabaseSyncInWorker = 314, // This didn't work because of crbug.com/376039. Available since M37.
    312         PrefixedAllowFullscreenAttribute = 315,
    313         XHRProgressEventPosition = 316,
    314         XHRProgressEventTotalSize = 317,
    315         PrefixedDocumentIsFullscreen = 318,
    316         PrefixedDocumentFullScreenKeyboardInputAllowed = 319,
    317         PrefixedDocumentCurrentFullScreenElement = 320,
    318         PrefixedDocumentCancelFullScreen = 321,
    319         PrefixedDocumentFullscreenEnabled = 322,
    320         PrefixedDocumentFullscreenElement = 323,
    321         PrefixedDocumentExitFullscreen = 324,
    322         // The above items are available in M35 branch.
    323 
    324         SVGForeignObjectElement = 325,
    325         PrefixedElementRequestPointerLock = 326,
    326         SelectionSetPosition = 327,
    327         AnimationPlayerFinishEvent = 328,
    328         SVGSVGElementInXMLDocument = 329,
    329         CanvasRenderingContext2DSetAlpha = 330,
    330         CanvasRenderingContext2DSetCompositeOperation = 331,
    331         CanvasRenderingContext2DSetLineWidth = 332,
    332         CanvasRenderingContext2DSetLineCap = 333,
    333         CanvasRenderingContext2DSetLineJoin = 334,
    334         CanvasRenderingContext2DSetMiterLimit = 335,
    335         CanvasRenderingContext2DClearShadow = 336,
    336         CanvasRenderingContext2DSetStrokeColor = 337,
    337         CanvasRenderingContext2DSetFillColor = 338,
    338         CanvasRenderingContext2DDrawImageFromRect = 339,
    339         CanvasRenderingContext2DSetShadow = 340,
    340         PrefixedPerformanceClearResourceTimings = 341,
    341         PrefixedPerformanceSetResourceTimingBufferSize = 342,
    342         EventSrcElement = 343,
    343         EventCancelBubble = 344,
    344         EventPath = 345,
    345         EventClipboardData = 346,
    346         NodeIteratorDetach = 347,
    347         AttrNodeValue = 348,
    348         AttrTextContent = 349,
    349         EventGetReturnValueTrue = 350,
    350         EventGetReturnValueFalse = 351,
    351         EventSetReturnValueTrue = 352,
    352         EventSetReturnValueFalse = 353,
    353         NodeIteratorExpandEntityReferences = 354,
    354         TreeWalkerExpandEntityReferences = 355,
    355         WindowOffscreenBuffering = 356,
    356         WindowDefaultStatus = 357,
    357         WindowDefaultstatus = 358,
    358         PrefixedConvertPointFromPageToNode = 359,
    359         PrefixedConvertPointFromNodeToPage = 360,
    360         PrefixedTransitionEventConstructor = 361,
    361         PrefixedMutationObserverConstructor = 362,
    362         PrefixedIDBCursorConstructor = 363,
    363         PrefixedIDBDatabaseConstructor = 364,
    364         PrefixedIDBFactoryConstructor = 365,
    365         PrefixedIDBIndexConstructor = 366,
    366         PrefixedIDBKeyRangeConstructor = 367,
    367         PrefixedIDBObjectStoreConstructor = 368,
    368         PrefixedIDBRequestConstructor = 369,
    369         PrefixedIDBTransactionConstructor = 370,
    370         NotificationPermission = 371,
    371         RangeDetach = 372,
    372         DocumentImportNodeOptionalArgument = 373,
    373         HTMLTableElementVspace = 374,
    374         HTMLTableElementHspace = 375,
    375         PrefixedDocumentExitPointerLock = 376,
    376         PrefixedDocumentPointerLockElement = 377,
    377         PrefixedTouchRadiusX = 378,
    378         PrefixedTouchRadiusY = 379,
    379         PrefixedTouchRotationAngle = 380,
    380         PrefixedTouchForce = 381,
    381         PrefixedMouseEventMovementX = 382,
    382         PrefixedMouseEventMovementY = 383,
    383         PrefixedWheelEventDirectionInvertedFromDevice = 384,
    384         PrefixedWheelEventInit = 385,
    385         PrefixedFileRelativePath = 386,
    386         DocumentCaretRangeFromPoint = 387,
    387         DocumentGetCSSCanvasContext = 388,
    388         ElementScrollIntoViewIfNeeded = 389,
    389         ElementScrollByLines = 390,
    390         ElementScrollByPages = 391,
    391         RangeCompareNode = 392,
    392         RangeExpand = 393,
    393         HTMLFrameElementWidth = 394,
    394         HTMLFrameElementHeight = 395,
    395         HTMLImageElementX = 396,
    396         HTMLImageElementY = 397,
    397         HTMLOptionsCollectionRemoveElement = 398,
    398         HTMLPreElementWrap = 399,
    399         SelectionBaseNode = 400,
    400         SelectionBaseOffset = 401,
    401         SelectionExtentNode = 402,
    402         SelectionExtentOffset = 403,
    403         SelectionType = 404,
    404         SelectionModify = 405,
    405         SelectionSetBaseAndExtent = 406,
    406         SelectionEmpty = 407,
    407         SVGFEMorphologyElementSetRadius = 408,
    408         VTTCue = 409,
    409         VTTCueRender = 410,
    410         VTTCueRenderVertical = 411,
    411         VTTCueRenderSnapToLinesFalse = 412,
    412         VTTCueRenderLineNotAuto = 413,
    413         VTTCueRenderPositionNot50 = 414,
    414         VTTCueRenderSizeNot100 = 415,
    415         VTTCueRenderAlignNotMiddle = 416,
    416         // The above items are available in M36 branch.
    417 
    418         ElementRequestPointerLock = 417,
    419         VTTCueRenderRtl = 418,
    420         PostMessageFromSecureToInsecure = 419,
    421         PostMessageFromInsecureToSecure = 420,
    422         DocumentExitPointerLock = 421,
    423         DocumentPointerLockElement = 422,
    424         PrefixedCursorZoomIn = 424,
    425         PrefixedCursorZoomOut = 425,
    426         CSSCharsetRuleEncoding = 426,
    427         DocumentSetCharset = 427,
    428         DocumentDefaultCharset = 428,
    429         TextEncoderConstructor = 429,
    430         TextEncoderEncode = 430,
    431         TextDecoderConstructor = 431,
    432         TextDecoderDecode= 432,
    433         FocusInOutEvent = 433,
    434         MouseEventMovementX = 434,
    435         MouseEventMovementY = 435,
    436         MixedContentTextTrack = 436,
    437         MixedContentRaw = 437,
    438         MixedContentImage = 438,
    439         MixedContentMedia = 439,
    440         DocumentFonts = 440,
    441         MixedContentFormsSubmitted = 441,
    442         FormsSubmitted = 442,
    443         TextInputEventOnInput = 443,
    444         TextInputEventOnTextArea = 444,
    445         TextInputEventOnContentEditable= 445,
    446         TextInputEventOnNotNode = 446,
    447         WebkitBeforeTextInsertedOnInput = 447,
    448         WebkitBeforeTextInsertedOnTextArea = 448,
    449         WebkitBeforeTextInsertedOnContentEditable = 449,
    450         WebkitBeforeTextInsertedOnNotNode = 450,
    451         WebkitEditableContentChangedOnInput = 451,
    452         WebkitEditableContentChangedOnTextArea = 452,
    453         WebkitEditableContentChangedOnContentEditable = 453,
    454         WebkitEditableContentChangedOnNotNode = 454,
    455         HTMLImports = 455,
    456         ElementCreateShadowRoot = 456,
    457         DocumentRegisterElement = 457,
    458         EditingAppleInterchangeNewline = 458,
    459         EditingAppleConvertedSpace = 459,
    460         EditingApplePasteAsQuotation = 460,
    461         EditingAppleStyleSpanClass = 461,
    462         EditingAppleTabSpanClass = 462,
    463         HTMLImportsAsyncAttribute = 463,
    464         FontFaceSetReady = 464,
    465         XMLHttpRequestSynchronous = 465,
    466         CSSSelectorPseudoUnresolved = 466,
    467         CSSSelectorPseudoShadow = 467,
    468         CSSSelectorPseudoContent = 468,
    469         CSSSelectorPseudoHost = 469,
    470         CSSSelectorPseudoHostContext = 470,
    471         CSSDeepCombinator = 471,
    472         SyncXHRWithCredentials = 472,
    473         // Add new features immediately above this line. Don't change assigned
    474         // numbers of any item, and don't reuse removed slots.
    475         // Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/
    476         // to update the UMA mapping.
    477         NumberOfFeatures, // This enum value must be last.
    478     };
    479 
    480     // "count" sets the bit for this feature to 1. Repeated calls are ignored.
    481     static void count(const Document&, Feature);
    482     // This doesn't count for ExecutionContexts for shared workers and service
    483     // workers.
    484     static void count(const ExecutionContext*, Feature);
    485     void count(CSSParserContext, CSSPropertyID);
    486     void count(Feature);
    487 
    488     // "countDeprecation" sets the bit for this feature to 1, and sends a deprecation
    489     // warning to the console. Repeated calls are ignored.
    490     //
    491     // Be considerate to developers' consoles: features should only send
    492     // deprecation warnings when we're actively interested in removing them from
    493     // the platform.
    494     //
    495     // The ExecutionContext* overload doesn't work for shared workers and
    496     // service workers.
    497     static void countDeprecation(const LocalDOMWindow*, Feature);
    498     static void countDeprecation(ExecutionContext*, Feature);
    499     static void countDeprecation(const Document&, Feature);
    500     String deprecationMessage(Feature);
    501 
    502     void didCommitLoad();
    503 
    504     static UseCounter* getFrom(const Document*);
    505     static UseCounter* getFrom(const CSSStyleSheet*);
    506     static UseCounter* getFrom(const StyleSheetContents*);
    507 
    508     static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id);
    509 
    510     static void muteForInspector();
    511     static void unmuteForInspector();
    512 
    513 private:
    514     static int m_muteCount;
    515 
    516     bool recordMeasurement(Feature feature)
    517     {
    518         if (UseCounter::m_muteCount)
    519             return false;
    520         ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
    521         ASSERT(feature < NumberOfFeatures);
    522         if (!m_countBits) {
    523             m_countBits = adoptPtr(new BitVector(NumberOfFeatures));
    524             m_countBits->clearAll();
    525         }
    526 
    527         if (m_countBits->quickGet(feature))
    528             return false;
    529 
    530         m_countBits->quickSet(feature);
    531         return true;
    532     }
    533 
    534     void updateMeasurements();
    535 
    536     OwnPtr<BitVector> m_countBits;
    537     BitVector m_CSSFeatureBits;
    538 };
    539 
    540 } // namespace WebCore
    541 
    542 #endif // UseCounter_h
    543