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 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 public: | 1632 public: |
1633 // Notified when a feature is counted for the first time. This should return | 1633 // Notified when a feature is counted for the first time. This should return |
1634 // true if it no longer needs to observe changes so that the counter can | 1634 // true if it no longer needs to observe changes so that the counter can |
1635 // remove a reference to the observer and stop notifications. | 1635 // remove a reference to the observer and stop notifications. |
1636 virtual bool OnCountFeature(Feature) = 0; | 1636 virtual bool OnCountFeature(Feature) = 0; |
1637 | 1637 |
1638 DEFINE_INLINE_VIRTUAL_TRACE() {} | 1638 DEFINE_INLINE_VIRTUAL_TRACE() {} |
1639 }; | 1639 }; |
1640 | 1640 |
1641 // "count" sets the bit for this feature to 1. Repeated calls are ignored. | 1641 // "count" sets the bit for this feature to 1. Repeated calls are ignored. |
1642 static void Count(const Frame*, Feature); | 1642 static void Count(const LocalFrame*, Feature); |
1643 static void Count(const Document&, Feature); | 1643 static void Count(const Document&, Feature); |
1644 static void Count(ExecutionContext*, Feature); | 1644 static void Count(ExecutionContext*, Feature); |
1645 | 1645 |
1646 void Count(CSSParserMode, CSSPropertyID); | 1646 void Count(CSSParserMode, CSSPropertyID); |
1647 void Count(Feature); | 1647 void Count(Feature, const LocalFrame*); |
1648 | 1648 |
1649 static void CountAnimatedCSS(const Document&, CSSPropertyID); | 1649 static void CountAnimatedCSS(const Document&, CSSPropertyID); |
1650 void CountAnimatedCSS(CSSPropertyID); | 1650 void CountAnimatedCSS(CSSPropertyID); |
1651 | 1651 |
1652 // Count only features if they're being used in an iframe which does not | 1652 // Count only features if they're being used in an iframe which does not |
1653 // have script access into the top level document. | 1653 // have script access into the top level document. |
1654 static void CountCrossOriginIframe(const Document&, Feature); | 1654 static void CountCrossOriginIframe(const Document&, Feature); |
1655 | 1655 |
1656 // Return whether the Feature was previously counted for this document. | 1656 // Return whether the Feature was previously counted for this document. |
1657 // NOTE: only for use in testing. | 1657 // NOTE: only for use in testing. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1727 // Tracks what features/properties need to be reported to the legacy | 1727 // Tracks what features/properties need to be reported to the legacy |
1728 // histograms. | 1728 // histograms. |
1729 BitVector feature_bits_; | 1729 BitVector feature_bits_; |
1730 BitVector css_bits_; | 1730 BitVector css_bits_; |
1731 } legacy_counter_; | 1731 } legacy_counter_; |
1732 }; | 1732 }; |
1733 | 1733 |
1734 } // namespace blink | 1734 } // namespace blink |
1735 | 1735 |
1736 #endif // UseCounter_h | 1736 #endif // UseCounter_h |
OLD | NEW |