2ab44fc3af269110047a0a528a76f7a244d37894
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / frame / UseCounter.h
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         OpenWebDatabaseInWorker = 313, // This didn't work because of crbug.com/376039. Available since M37.
305         OpenWebDatabaseSyncInWorker = 314, // This didn't work because of crbug.com/376039. Available since M37.
306         XHRProgressEventPosition = 316,
307         XHRProgressEventTotalSize = 317,
308         PrefixedDocumentIsFullscreen = 318,
309         PrefixedDocumentFullScreenKeyboardInputAllowed = 319,
310         PrefixedDocumentCurrentFullScreenElement = 320,
311         PrefixedDocumentCancelFullScreen = 321,
312         PrefixedDocumentFullscreenEnabled = 322,
313         PrefixedDocumentFullscreenElement = 323,
314         PrefixedDocumentExitFullscreen = 324,
315         // The above items are available in M35 branch.
316
317         SVGForeignObjectElement = 325,
318         SelectionSetPosition = 327,
319         AnimationPlayerFinishEvent = 328,
320         SVGSVGElementInXMLDocument = 329,
321         CanvasRenderingContext2DSetAlpha = 330,
322         CanvasRenderingContext2DSetCompositeOperation = 331,
323         CanvasRenderingContext2DSetLineWidth = 332,
324         CanvasRenderingContext2DSetLineCap = 333,
325         CanvasRenderingContext2DSetLineJoin = 334,
326         CanvasRenderingContext2DSetMiterLimit = 335,
327         CanvasRenderingContext2DClearShadow = 336,
328         CanvasRenderingContext2DSetStrokeColor = 337,
329         CanvasRenderingContext2DSetFillColor = 338,
330         CanvasRenderingContext2DDrawImageFromRect = 339,
331         CanvasRenderingContext2DSetShadow = 340,
332         PrefixedPerformanceClearResourceTimings = 341,
333         PrefixedPerformanceSetResourceTimingBufferSize = 342,
334         EventSrcElement = 343,
335         EventCancelBubble = 344,
336         EventPath = 345,
337         EventClipboardData = 346,
338         NodeIteratorDetach = 347,
339         AttrNodeValue = 348,
340         AttrTextContent = 349,
341         EventGetReturnValueTrue = 350,
342         EventGetReturnValueFalse = 351,
343         EventSetReturnValueTrue = 352,
344         EventSetReturnValueFalse = 353,
345         NodeIteratorExpandEntityReferences = 354,
346         TreeWalkerExpandEntityReferences = 355,
347         WindowOffscreenBuffering = 356,
348         WindowDefaultStatus = 357,
349         WindowDefaultstatus = 358,
350         PrefixedTransitionEventConstructor = 361,
351         PrefixedMutationObserverConstructor = 362,
352         PrefixedIDBCursorConstructor = 363,
353         PrefixedIDBDatabaseConstructor = 364,
354         PrefixedIDBFactoryConstructor = 365,
355         PrefixedIDBIndexConstructor = 366,
356         PrefixedIDBKeyRangeConstructor = 367,
357         PrefixedIDBObjectStoreConstructor = 368,
358         PrefixedIDBRequestConstructor = 369,
359         PrefixedIDBTransactionConstructor = 370,
360         NotificationPermission = 371,
361         RangeDetach = 372,
362         HTMLTableElementVspace = 374,
363         HTMLTableElementHspace = 375,
364         PrefixedTouchRadiusX = 378,
365         PrefixedTouchRadiusY = 379,
366         PrefixedTouchRotationAngle = 380,
367         PrefixedTouchForce = 381,
368         PrefixedMouseEventMovementX = 382,
369         PrefixedMouseEventMovementY = 383,
370         PrefixedFileRelativePath = 386,
371         DocumentCaretRangeFromPoint = 387,
372         DocumentGetCSSCanvasContext = 388,
373         ElementScrollIntoViewIfNeeded = 389,
374         RangeCompareNode = 392,
375         RangeExpand = 393,
376         HTMLImageElementX = 396,
377         HTMLImageElementY = 397,
378         SelectionBaseNode = 400,
379         SelectionBaseOffset = 401,
380         SelectionExtentNode = 402,
381         SelectionExtentOffset = 403,
382         SelectionType = 404,
383         SelectionModify = 405,
384         SelectionSetBaseAndExtent = 406,
385         SelectionEmpty = 407,
386         VTTCue = 409,
387         VTTCueRender = 410,
388         VTTCueRenderVertical = 411,
389         VTTCueRenderSnapToLinesFalse = 412,
390         VTTCueRenderLineNotAuto = 413,
391         VTTCueRenderPositionNot50 = 414,
392         VTTCueRenderSizeNot100 = 415,
393         VTTCueRenderAlignNotMiddle = 416,
394         // The above items are available in M36 branch.
395
396         ElementRequestPointerLock = 417,
397         VTTCueRenderRtl = 418,
398         PostMessageFromSecureToInsecure = 419,
399         PostMessageFromInsecureToSecure = 420,
400         DocumentExitPointerLock = 421,
401         DocumentPointerLockElement = 422,
402         PrefixedCursorZoomIn = 424,
403         PrefixedCursorZoomOut = 425,
404         CSSCharsetRuleEncoding = 426,
405         DocumentSetCharset = 427,
406         DocumentDefaultCharset = 428,
407         TextEncoderConstructor = 429,
408         TextEncoderEncode = 430,
409         TextDecoderConstructor = 431,
410         TextDecoderDecode = 432,
411         FocusInOutEvent = 433,
412         MouseEventMovementX = 434,
413         MouseEventMovementY = 435,
414         MixedContentRaw = 437,
415         MixedContentImage = 438,
416         MixedContentMedia = 439,
417         DocumentFonts = 440,
418         MixedContentFormsSubmitted = 441,
419         FormsSubmitted = 442,
420         TextInputEventOnInput = 443,
421         TextInputEventOnTextArea = 444,
422         TextInputEventOnContentEditable = 445,
423         TextInputEventOnNotNode = 446,
424         WebkitBeforeTextInsertedOnInput = 447,
425         WebkitBeforeTextInsertedOnTextArea = 448,
426         WebkitBeforeTextInsertedOnContentEditable = 449,
427         WebkitBeforeTextInsertedOnNotNode = 450,
428         WebkitEditableContentChangedOnInput = 451,
429         WebkitEditableContentChangedOnTextArea = 452,
430         WebkitEditableContentChangedOnContentEditable = 453,
431         WebkitEditableContentChangedOnNotNode = 454,
432         HTMLImports = 455,
433         ElementCreateShadowRoot = 456,
434         DocumentRegisterElement = 457,
435         EditingAppleInterchangeNewline = 458,
436         EditingAppleConvertedSpace = 459,
437         EditingApplePasteAsQuotation = 460,
438         EditingAppleStyleSpanClass = 461,
439         EditingAppleTabSpanClass = 462,
440         HTMLImportsAsyncAttribute = 463,
441         FontFaceSetReady = 464,
442         XMLHttpRequestSynchronous = 465,
443         CSSSelectorPseudoUnresolved = 466,
444         CSSSelectorPseudoShadow = 467,
445         CSSSelectorPseudoContent = 468,
446         CSSSelectorPseudoHost = 469,
447         CSSSelectorPseudoHostContext = 470,
448         CSSDeepCombinator = 471,
449         SyncXHRWithCredentials = 472,
450         // The above items are available in M37 branch.
451
452         UseAsm = 473,
453         KeyEventNotAllowedInFullScreen = 474,
454         DOMWindowOpen = 475,
455         DOMWindowOpenFeatures = 476,
456         MediaStreamTrackGetSources = 478,
457         AspectRatioFlexItem = 479,
458         DetailsElement = 480,
459         DialogElement = 481,
460         MapElement = 482,
461         MeterElement = 483,
462         ProgressElement = 484,
463         VideoFullscreenAllowedExemption = 485,
464         WebKitPoint = 488,
465         PrefixedHTMLElementDropzone = 490,
466         WheelEventWheelDeltaX = 491,
467         WheelEventWheelDeltaY = 492,
468         WheelEventWheelDelta = 493,
469         SendBeacon = 494,
470         SendBeaconQuotaExceeded = 495,
471         SVGSMILElementInDocument = 501,
472         MouseEventOffsetX = 502,
473         MouseEventOffsetY = 503,
474         MouseEventX = 504,
475         MouseEventY = 505,
476         MouseEventFromElement = 506,
477         MouseEventToElement = 507,
478         RequestFileSystem = 508,
479         RequestFileSystemWorker = 509,
480         RequestFileSystemSyncWorker = 510,
481         UIEventLayerX = 511,
482         UIEventLayerY = 512,
483         UIEventPageX = 513,
484         UIEventPageY = 514,
485         BgPropertiesFixed = 515,
486         HTMLImageElementComposite = 516,
487         DevToolsConsoleTimeline = 517,
488         DevToolsConsoleProfile = 518,
489         SVGStyleElementTitle = 519,
490         PictureSourceSrc = 520,
491         // Add new features immediately above this line. Don't change assigned
492         // numbers of any item, and don't reuse removed slots.
493         // Also, run update_use_counter_feature_enum.py in chromium/src/tools/metrics/histograms/
494         // to update the UMA mapping.
495         NumberOfFeatures, // This enum value must be last.
496     };
497
498     // "count" sets the bit for this feature to 1. Repeated calls are ignored.
499     static void count(const Document&, Feature);
500     // This doesn't count for ExecutionContexts for shared workers and service
501     // workers.
502     static void count(const ExecutionContext*, Feature);
503     void count(CSSParserContext, CSSPropertyID);
504     void count(Feature);
505
506     // "countDeprecation" sets the bit for this feature to 1, and sends a deprecation
507     // warning to the console. Repeated calls are ignored.
508     //
509     // Be considerate to developers' consoles: features should only send
510     // deprecation warnings when we're actively interested in removing them from
511     // the platform.
512     //
513     // The ExecutionContext* overload doesn't work for shared workers and
514     // service workers.
515     static void countDeprecation(const LocalDOMWindow*, Feature);
516     static void countDeprecation(ExecutionContext*, Feature);
517     static void countDeprecation(const Document&, Feature);
518     String deprecationMessage(Feature);
519
520     void didCommitLoad();
521
522     static UseCounter* getFrom(const Document*);
523     static UseCounter* getFrom(const CSSStyleSheet*);
524     static UseCounter* getFrom(const StyleSheetContents*);
525
526     static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id);
527
528     static void muteForInspector();
529     static void unmuteForInspector();
530
531 private:
532     static int m_muteCount;
533
534     bool recordMeasurement(Feature feature)
535     {
536         if (UseCounter::m_muteCount)
537             return false;
538         ASSERT(feature != PageDestruction); // PageDestruction is reserved as a scaling factor.
539         ASSERT(feature < NumberOfFeatures);
540         if (!m_countBits) {
541             m_countBits = adoptPtr(new BitVector(NumberOfFeatures));
542             m_countBits->clearAll();
543         }
544
545         if (m_countBits->quickGet(feature))
546             return false;
547
548         m_countBits->quickSet(feature);
549         return true;
550     }
551
552     void updateMeasurements();
553
554     OwnPtr<BitVector> m_countBits;
555     BitVector m_CSSFeatureBits;
556 };
557
558 } // namespace blink
559
560 #endif // UseCounter_h