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 25 matching lines...) Expand all Loading... |
36 #include "platform/wtf/Noncopyable.h" | 36 #include "platform/wtf/Noncopyable.h" |
37 #include "platform/wtf/text/WTFString.h" | 37 #include "platform/wtf/text/WTFString.h" |
38 #include "v8/include/v8.h" | 38 #include "v8/include/v8.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class CSSStyleSheet; | 42 class CSSStyleSheet; |
43 class Document; | 43 class Document; |
44 class EnumerationHistogram; | 44 class EnumerationHistogram; |
45 class ExecutionContext; | 45 class ExecutionContext; |
46 class Frame; | 46 class LocalFrame; |
47 class StyleSheetContents; | 47 class StyleSheetContents; |
48 | 48 |
49 // UseCounter is used for counting the number of times features of | 49 // UseCounter is used for counting the number of times features of |
50 // Blink are used on real web pages and help us know commonly | 50 // Blink are used on real web pages and help us know commonly |
51 // features are used and thus when it's safe to remove or change them. | 51 // features are used and thus when it's safe to remove or change them. |
52 // | 52 // |
53 // The Chromium Content layer controls what is done with this data. | 53 // The Chromium Content layer controls what is done with this data. |
54 // | 54 // |
55 // For instance, in Google Chrome, these counts are submitted anonymously | 55 // For instance, in Google Chrome, these counts are submitted anonymously |
56 // through the UMA histogram recording system in Chrome for users who have the | 56 // through the UMA histogram recording system in Chrome for users who have the |
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 public: | 1597 public: |
1598 // Notified when a feature is counted for the first time. This should return | 1598 // Notified when a feature is counted for the first time. This should return |
1599 // true if it no longer needs to observe changes so that the counter can | 1599 // true if it no longer needs to observe changes so that the counter can |
1600 // remove a reference to the observer and stop notifications. | 1600 // remove a reference to the observer and stop notifications. |
1601 virtual bool OnCountFeature(Feature) = 0; | 1601 virtual bool OnCountFeature(Feature) = 0; |
1602 | 1602 |
1603 DEFINE_INLINE_VIRTUAL_TRACE() {} | 1603 DEFINE_INLINE_VIRTUAL_TRACE() {} |
1604 }; | 1604 }; |
1605 | 1605 |
1606 // "count" sets the bit for this feature to 1. Repeated calls are ignored. | 1606 // "count" sets the bit for this feature to 1. Repeated calls are ignored. |
1607 static void Count(const Frame*, Feature); | 1607 static void Count(const LocalFrame*, Feature); |
1608 static void Count(const Document&, Feature); | 1608 static void Count(const Document&, Feature); |
1609 static void Count(ExecutionContext*, Feature); | 1609 static void Count(ExecutionContext*, Feature); |
1610 | 1610 |
1611 void Count(CSSParserMode, CSSPropertyID); | 1611 void Count(CSSParserMode, CSSPropertyID); |
1612 void Count(Feature); | 1612 void Count(Feature); |
1613 | 1613 |
1614 static void CountAnimatedCSS(const Document&, CSSPropertyID); | 1614 static void CountAnimatedCSS(const Document&, CSSPropertyID); |
1615 void CountAnimatedCSS(CSSPropertyID); | 1615 void CountAnimatedCSS(CSSPropertyID); |
1616 | 1616 |
1617 // Count only features if they're being used in an iframe which does not | 1617 // Count only features if they're being used in an iframe which does not |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 // Tracks what features/properties need to be reported to the legacy | 1694 // Tracks what features/properties need to be reported to the legacy |
1695 // histograms. | 1695 // histograms. |
1696 BitVector feature_bits_; | 1696 BitVector feature_bits_; |
1697 BitVector css_bits_; | 1697 BitVector css_bits_; |
1698 } legacy_counter_; | 1698 } legacy_counter_; |
1699 }; | 1699 }; |
1700 | 1700 |
1701 } // namespace blink | 1701 } // namespace blink |
1702 | 1702 |
1703 #endif // UseCounter_h | 1703 #endif // UseCounter_h |
OLD | NEW |