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 blink {
     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         ShowModalDialog = 195,
    210         PrefixedPageVisibility = 196,
    211         CSSStyleSheetInsertRuleOptionalArg = 198, // Inconsistent with the specification and other browsers.
    212         DocumentBeforeUnloadRegistered = 200,
    213         DocumentBeforeUnloadFired = 201,
    214         DocumentUnloadRegistered = 202,
    215         DocumentUnloadFired = 203,
    216         SVGLocatableNearestViewportElement = 204,
    217         SVGLocatableFarthestViewportElement = 205,
    218         HTMLHeadElementProfile = 207,
    219         OverflowChangedEvent = 208,
    220         SVGPointMatrixTransform = 209,
    221         DOMFocusInOutEvent = 211,
    222         FileGetLastModifiedDate = 212,
    223         HTMLElementInnerText = 213,
    224         HTMLElementOuterText = 214,
    225         ReplaceDocumentViaJavaScriptURL = 215,
    226         ElementSetAttributeNodeNS = 216, // Removed from DOM4.
    227         ElementPrefixedMatchesSelector = 217,
    228         CSSStyleSheetRules = 219,
    229         CSSStyleSheetAddRule = 220,
    230         CSSStyleSheetRemoveRule = 221,
    231         // The above items are available in M33 branch.
    232 
    233         InitMessageEvent = 222,
    234         ElementSetPrefix = 224, // Element.prefix is readonly in DOM4.
    235         CSSStyleDeclarationGetPropertyCSSValue = 225,
    236         PrefixedMediaCancelKeyRequest = 229,
    237         DOMImplementationHasFeature = 230,
    238         DOMImplementationHasFeatureReturnFalse = 231,
    239         CanPlayTypeKeySystem = 232,
    240         PrefixedDevicePixelRatioMediaFeature = 233,
    241         PrefixedMaxDevicePixelRatioMediaFeature = 234,
    242         PrefixedMinDevicePixelRatioMediaFeature = 235,
    243         PrefixedTransform3dMediaFeature = 237,
    244         PrefixedStorageQuota = 240,
    245         ContentSecurityPolicyReportOnlyInMeta = 241,
    246         ResetReferrerPolicy = 243,
    247         CaseInsensitiveAttrSelectorMatch = 244, // Case-insensitivity dropped from specification.
    248         FormNameAccessForImageElement = 246,
    249         FormNameAccessForPastNamesMap = 247,
    250         FormAssociationByParser = 248,
    251         SVGSVGElementInDocument = 250,
    252         SVGDocumentRootElement = 251,
    253         MediaErrorEncrypted = 253,
    254         EventSourceURL = 254,
    255         WebSocketURL = 255,
    256         WorkerSubjectToCSP = 257,
    257         WorkerAllowedByChildBlockedByScript = 258,
    258         DeprecatedWebKitGradient = 260,
    259         DeprecatedWebKitLinearGradient = 261,
    260         DeprecatedWebKitRepeatingLinearGradient = 262,
    261         DeprecatedWebKitRadialGradient = 263,
    262         DeprecatedWebKitRepeatingRadialGradient = 264,
    263         PrefixedImageSmoothingEnabled = 267,
    264         UnprefixedImageSmoothingEnabled = 268,
    265         // The above items are available in M34 branch.
    266 
    267         TextAutosizing = 274,
    268         HTMLAnchorElementPingAttribute = 276,
    269         InsertAdjacentHTML = 278,
    270         SVGClassName = 279,
    271         HTMLAppletElement = 280,
    272         HTMLMediaElementSeekToFragmentStart = 281,
    273         HTMLMediaElementPauseAtFragmentEnd = 282,
    274         PrefixedWindowURL = 283,
    275         PrefixedWorkerURL = 284, // This didn't work because of crbug.com/376039. Available since M37.
    276         WindowOrientation = 285,
    277         DOMStringListContains = 286,
    278         DocumentCaptureEvents = 287,
    279         DocumentReleaseEvents = 288,
    280         WindowCaptureEvents = 289,
    281         WindowReleaseEvents = 290,
    282         PrefixedGamepad = 291,
    283         ElementAnimateKeyframeListEffectObjectTiming = 292,
    284         ElementAnimateKeyframeListEffectDoubleTiming = 293,
    285         ElementAnimateKeyframeListEffectNoTiming = 294,
    286         DocumentXPathCreateExpression = 295,
    287         DocumentXPathCreateNSResolver = 296,
    288         DocumentXPathEvaluate = 297,
    289         AttrGetValue = 298,
    290         AttrSetValue = 299,
    291         AnimationConstructorKeyframeListEffectObjectTiming = 300,
    292         AnimationConstructorKeyframeListEffectDoubleTiming = 301,
    293         AnimationConstructorKeyframeListEffectNoTiming = 302,
    294         AttrSetValueWithElement = 303,
    295         PrefixedCancelAnimationFrame = 304,
    296         PrefixedCancelRequestAnimationFrame = 305,
    297         NamedNodeMapGetNamedItem = 306,
    298         NamedNodeMapSetNamedItem = 307,
    299         NamedNodeMapRemoveNamedItem = 308,
    300         NamedNodeMapItem = 309,
    301         NamedNodeMapGetNamedItemNS = 310,
    302         NamedNodeMapSetNamedItemNS = 311,
    303         NamedNodeMapRemoveNamedItemNS = 312,
    304         XHRProgressEventPosition = 316,
    305         XHRProgressEventTotalSize = 317,
    306         PrefixedDocumentIsFullscreen = 318,
    307         PrefixedDocumentFullScreenKeyboardInputAllowed = 319,
    308         PrefixedDocumentCurrentFullScreenElement = 320,
    309         PrefixedDocumentCancelFullScreen = 321,
    310         PrefixedDocumentFullscreenEnabled = 322,
    311         PrefixedDocumentFullscreenElement = 323,
    312         PrefixedDocumentExitFullscreen = 324,
    313         // The above items are available in M35 branch.
    314 
    315         SVGForeignObjectElement = 325,
    316         SelectionSetPosition = 327,
    317         AnimationPlayerFinishEvent = 328,
    318         SVGSVGElementInXMLDocument = 329,
    319         CanvasRenderingContext2DSetAlpha = 330,
    320         CanvasRenderingContext2DSetCompositeOperation = 331,
    321         CanvasRenderingContext2DSetLineWidth = 332,
    322         CanvasRenderingContext2DSetLineCap = 333,
    323         CanvasRenderingContext2DSetLineJoin = 334,
    324         CanvasRenderingContext2DSetMiterLimit = 335,
    325         CanvasRenderingContext2DClearShadow = 336,
    326         CanvasRenderingContext2DSetStrokeColor = 337,
    327         CanvasRenderingContext2DSetFillColor = 338,
    328         CanvasRenderingContext2DDrawImageFromRect = 339,
    329         CanvasRenderingContext2DSetShadow = 340,
    330         PrefixedPerformanceClearResourceTimings = 341,
    331         PrefixedPerformanceSetResourceTimingBufferSize = 342,
    332         EventSrcElement = 343,
    333         EventCancelBubble = 344,
    334         EventPath = 345,
    335         EventClipboardData = 346,
    336         NodeIteratorDetach = 347,
    337         AttrNodeValue = 348,
    338         AttrTextContent = 349,
    339         EventGetReturnValueTrue = 350,
    340         EventGetReturnValueFalse = 351,
    341         EventSetReturnValueTrue = 352,
    342         EventSetReturnValueFalse = 353,
    343         NodeIteratorExpandEntityReferences = 354,
    344         TreeWalkerExpandEntityReferences = 355,
    345         WindowOffscreenBuffering = 356,
    346         WindowDefaultStatus = 357,
    347         WindowDefaultstatus = 358,
    348         PrefixedTransitionEventConstructor = 361,
    349         PrefixedMutationObserverConstructor = 362,
    350         PrefixedIDBCursorConstructor = 363,
    351         PrefixedIDBDatabaseConstructor = 364,
    352         PrefixedIDBFactoryConstructor = 365,
    353         PrefixedIDBIndexConstructor = 366,
    354         PrefixedIDBKeyRangeConstructor = 367,
    355         PrefixedIDBObjectStoreConstructor = 368,
    356         PrefixedIDBRequestConstructor = 369,
    357         PrefixedIDBTransactionConstructor = 370,
    358         NotificationPermission = 371,
    359         RangeDetach = 372,
    360         HTMLTableElementVspace = 374,
    361         HTMLTableElementHspace = 375,
    362         PrefixedTouchRadiusX = 378,
    363         PrefixedTouchRadiusY = 379,
    364         PrefixedTouchRotationAngle = 380,
    365         PrefixedTouchForce = 381,
    366         PrefixedMouseEventMovementX = 382,
    367         PrefixedMouseEventMovementY = 383,
    368         PrefixedFileRelativePath = 386,
    369         DocumentCaretRangeFromPoint = 387,
    370         DocumentGetCSSCanvasContext = 388,
    371         ElementScrollIntoViewIfNeeded = 389,
    372         RangeCompareNode = 392,
    373         RangeExpand = 393,
    374         HTMLImageElementX = 396,
    375         HTMLImageElementY = 397,
    376         SelectionBaseNode = 400,
    377         SelectionBaseOffset = 401,
    378         SelectionExtentNode = 402,
    379         SelectionExtentOffset = 403,
    380         SelectionType = 404,
    381         SelectionModify = 405,
    382         SelectionSetBaseAndExtent = 406,
    383         SelectionEmpty = 407,
    384         VTTCue = 409,
    385         VTTCueRender = 410,
    386         VTTCueRenderVertical = 411,
    387         VTTCueRenderSnapToLinesFalse = 412,
    388         VTTCueRenderLineNotAuto = 413,
    389         VTTCueRenderPositionNot50 = 414,
    390         VTTCueRenderSizeNot100 = 415,
    391         VTTCueRenderAlignNotMiddle = 416,
    392         // The above items are available in M36 branch.
    393 
    394         ElementRequestPointerLock = 417,
    395         VTTCueRenderRtl = 418,
    396         PostMessageFromSecureToInsecure = 419,
    397         PostMessageFromInsecureToSecure = 420,
    398         DocumentExitPointerLock = 421,
    399         DocumentPointerLockElement = 422,
    400         PrefixedCursorZoomIn = 424,
    401         PrefixedCursorZoomOut = 425,
    402         CSSCharsetRuleEncoding = 426,
    403         DocumentSetCharset = 427,
    404         DocumentDefaultCharset = 428,
    405         TextEncoderConstructor = 429,
    406         TextEncoderEncode = 430,
    407         TextDecoderConstructor = 431,
    408         TextDecoderDecode = 432,
    409         FocusInOutEvent = 433,
    410         MouseEventMovementX = 434,
    411         MouseEventMovementY = 435,
    412         MixedContentRaw = 437,
    413         MixedContentImage = 438,
    414         MixedContentMedia = 439,
    415         DocumentFonts = 440,
    416         MixedContentFormsSubmitted = 441,
    417         FormsSubmitted = 442,
    418         TextInputEventOnInput = 443,
    419         TextInputEventOnTextArea = 444,
    420         TextInputEventOnContentEditable = 445,
    421         TextInputEventOnNotNode = 446,
    422         WebkitBeforeTextInsertedOnInput = 447,
    423         WebkitBeforeTextInsertedOnTextArea = 448,
    424         WebkitBeforeTextInsertedOnContentEditable = 449,
    425         WebkitBeforeTextInsertedOnNotNode = 450,
    426         WebkitEditableContentChangedOnInput = 451,
    427         WebkitEditableContentChangedOnTextArea = 452,
    428         WebkitEditableContentChangedOnContentEditable = 453,
    429         WebkitEditableContentChangedOnNotNode = 454,
    430         HTMLImports = 455,
    431         ElementCreateShadowRoot = 456,
    432         DocumentRegisterElement = 457,
    433         EditingAppleInterchangeNewline = 458,
    434         EditingAppleConvertedSpace = 459,
    435         EditingApplePasteAsQuotation = 460,
    436         EditingAppleStyleSpanClass = 461,
    437         EditingAppleTabSpanClass = 462,
    438         HTMLImportsAsyncAttribute = 463,
    439         FontFaceSetReady = 464,
    440         XMLHttpRequestSynchronous = 465,
    441         CSSSelectorPseudoUnresolved = 466,
    442         CSSSelectorPseudoShadow = 467,
    443         CSSSelectorPseudoContent = 468,
    444         CSSSelectorPseudoHost = 469,
    445         CSSSelectorPseudoHostContext = 470,
    446         CSSDeepCombinator = 471,
    447         SyncXHRWithCredentials = 472,
    448         // The above items are available in M37 branch.
    449 
    450         UseAsm = 473,
    451         KeyEventNotAllowedInFullScreen = 474,
    452         DOMWindowOpen = 475,
    453         DOMWindowOpenFeatures = 476,
    454         MediaStreamTrackGetSources = 478,
    455         AspectRatioFlexItem = 479,
    456         DetailsElement = 480,
    457         DialogElement = 481,
    458         MapElement = 482,
    459         MeterElement = 483,
    460         ProgressElement = 484,
    461         VideoFullscreenAllowedExemption = 485,
    462         PrefixedHTMLElementDropzone = 490,
    463         WheelEventWheelDeltaX = 491,
    464         WheelEventWheelDeltaY = 492,
    465         WheelEventWheelDelta = 493,
    466         SendBeacon = 494,
    467         SendBeaconQuotaExceeded = 495,
    468         SVGSMILElementInDocument = 501,
    469         MouseEventOffsetX = 502,
    470         MouseEventOffsetY = 503,
    471         MouseEventX = 504,
    472         MouseEventY = 505,
    473         MouseEventFromElement = 506,
    474         MouseEventToElement = 507,
    475         RequestFileSystem = 508,
    476         RequestFileSystemWorker = 509,
    477         RequestFileSystemSyncWorker = 510,
    478         UIEventLayerX = 511,
    479         UIEventLayerY = 512,
    480         UIEventPageX = 513,
    481         UIEventPageY = 514,
    482         BgPropertiesFixed = 515,
    483         HTMLImageElementComposite = 516,
    484         DevToolsConsoleTimeline = 517,
    485         DevToolsConsoleProfile = 518,
    486         SVGStyleElementTitle = 519,
    487         PictureSourceSrc = 520,
    488         // The above items are available in M38 branch.
    489 
    490         Picture = 521,
    491         Sizes = 522,
    492         SrcsetXDescriptor = 523,
    493         SrcsetWDescriptor = 524,
    494         SelectionContainsNode = 525,
    495         MediaStreamEnded = 526,
    496         MixedContentPrivateIPInPublicWebsitePassive = 527,
    497         MixedContentPrivateIPInPublicWebsiteActive = 528,
    498         XMLExternalResourceLoad = 529,
    499         MixedContentPrivateHostnameInPublicHostname = 530,
    500         LegacyProtocolEmbeddedAsSubresource = 531,
    501         RequestedSubresourceWithEmbeddedCredentials = 532,
    502         NotificationCreated = 533,
    503         NotificationClosed = 534,
    504         NotificationPermissionRequested = 535,
    505         MediaStreamLabel = 536,
    506         MediaStreamStop = 537,
    507         ConsoleTimeline = 538,
    508         ConsoleTimelineEnd = 539,
    509         SRIElementWithMatchingIntegrityAttribute = 540,
    510         SRIElementWithNonMatchingIntegrityAttribute = 541,
    511         SRIElementWithUnparsableIntegrityAttribute = 542,
    512         SRIElementWithIntegrityAttributeAndInsecureOrigin = 543,
    513         SRIElementWithIntegrityAttributeAndInsecureResource = 544,
    514         AnimationPlayerGetStartTime = 545,
    515         AnimationPlayerSetStartTime = 546,
    516         AnimationPlayerGetCurrentTime = 547,
    517         AnimationPlayerSetCurrentTime = 548,
    518         AnimationPlayerGetPlaybackRate = 549,
    519         AnimationPlayerSetPlaybackRate = 550,
    520         AnimationPlayerGetPlayState = 551,
    521         AnimationPlayerFinish = 552,
    522         AnimationPlayerPlay = 553,
    523         AnimationPlayerPause = 554,
    524         AnimationPlayerReverse = 555,
    525         // Add new features immediately above this line. Don't change assigned
    526         // numbers of any item, and don't reuse removed slots.
    527         // Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/
    528         // to update the UMA mapping.
    529         NumberOfFeatures, // This enum value must be last.
    530     };
    531 
    532     // "count" sets the bit for this feature to 1. Repeated calls are ignored.
    533     static void count(const Document&, Feature);
    534     // This doesn't count for ExecutionContexts for shared workers and service
    535     // workers.
    536     static void count(const ExecutionContext*, Feature);
    537     void count(CSSParserContext, CSSPropertyID);
    538     void count(Feature);
    539 
    540     // "countDeprecation" sets the bit for this feature to 1, and sends a deprecation
    541     // warning to the console. Repeated calls are ignored.
    542     //
    543     // Be considerate to developers' consoles: features should only send
    544     // deprecation warnings when we're actively interested in removing them from
    545     // the platform.
    546     //
    547     // The ExecutionContext* overload doesn't work for shared workers and
    548     // service workers.
    549     static void countDeprecation(const LocalDOMWindow*, Feature);
    550     static void countDeprecation(ExecutionContext*, Feature);
    551     static void countDeprecation(const Document&, Feature);
    552     String deprecationMessage(Feature);
    553 
    554     void didCommitLoad();
    555 
    556     static UseCounter* getFrom(const Document*);
    557     static UseCounter* getFrom(const CSSStyleSheet*);
    558     static UseCounter* getFrom(const StyleSheetContents*);
    559 
    560     static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id);
    561 
    562     static void muteForInspector();
    563     static void unmuteForInspector();
    564 
    565 private:
    566     static int m_muteCount;
    567 
    568     bool recordMeasurement(Feature feature)
    569     {
    570         if (UseCounter::m_muteCount)
    571             return false;
    572         ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
    573         ASSERT(feature < NumberOfFeatures);
    574         if (!m_countBits) {
    575             m_countBits = adoptPtr(new BitVector(NumberOfFeatures));
    576             m_countBits->clearAll();
    577         }
    578 
    579         if (m_countBits->quickGet(feature))
    580             return false;
    581 
    582         m_countBits->quickSet(feature);
    583         return true;
    584     }
    585 
    586     void updateMeasurements();
    587 
    588     OwnPtr<BitVector> m_countBits;
    589     BitVector m_CSSFeatureBits;
    590 };
    591 
    592 } // namespace blink
    593 
    594 #endif // UseCounter_h
    595