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