| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 Reflection, | 112 Reflection, |
| 113 CursorVisibility, | 113 CursorVisibility, |
| 114 StorageInfo, | 114 StorageInfo, |
| 115 XFrameOptions, | 115 XFrameOptions, |
| 116 XFrameOptionsSameOrigin, | 116 XFrameOptionsSameOrigin, |
| 117 XFrameOptionsSameOriginWithBadAncestorChain, | 117 XFrameOptionsSameOriginWithBadAncestorChain, |
| 118 DeprecatedFlexboxWebContent, | 118 DeprecatedFlexboxWebContent, |
| 119 DeprecatedFlexboxChrome, | 119 DeprecatedFlexboxChrome, |
| 120 DeprecatedFlexboxChromeExtension, | 120 DeprecatedFlexboxChromeExtension, |
| 121 SVGTRefElement, | 121 SVGTRefElement, |
| 122 UnprefixedPerformanceTimeline, |
| 123 PrefixedPerformanceTimeline, |
| 124 UnprefixedUserTiming, |
| 125 PrefixedUserTiming, |
| 122 // Add new features above this line. Don't change assigned numbers of ea
ch items. | 126 // Add new features above this line. Don't change assigned numbers of ea
ch items. |
| 123 NumberOfFeatures, // This enum value must be last. | 127 NumberOfFeatures, // This enum value must be last. |
| 124 }; | 128 }; |
| 125 | 129 |
| 126 // "observe" sets the bit for this feature to 1. Repeated calls are ignored. | 130 // "observe" sets the bit for this feature to 1. Repeated calls are ignored. |
| 127 static void observe(Document*, Feature); | 131 static void observe(Document*, Feature); |
| 128 static void observe(DOMWindow*, Feature); | 132 static void observe(DOMWindow*, Feature); |
| 129 void didCommitLoad(); | 133 void didCommitLoad(); |
| 130 | 134 |
| 131 private: | 135 private: |
| 132 void didObserve(Feature feature) | 136 void didObserve(Feature feature) |
| 133 { | 137 { |
| 134 ASSERT(feature != PageDestruction); // PageDestruction is reserved as a
scaling factor. | 138 ASSERT(feature != PageDestruction); // PageDestruction is reserved as a
scaling factor. |
| 135 ASSERT(feature < NumberOfFeatures); | 139 ASSERT(feature < NumberOfFeatures); |
| 136 if (!m_countBits) { | 140 if (!m_countBits) { |
| 137 m_countBits = adoptPtr(new BitVector(NumberOfFeatures)); | 141 m_countBits = adoptPtr(new BitVector(NumberOfFeatures)); |
| 138 m_countBits->clearAll(); | 142 m_countBits->clearAll(); |
| 139 } | 143 } |
| 140 m_countBits->quickSet(feature); | 144 m_countBits->quickSet(feature); |
| 141 } | 145 } |
| 142 | 146 |
| 143 void updateMeasurements(); | 147 void updateMeasurements(); |
| 144 | 148 |
| 145 OwnPtr<BitVector> m_countBits; | 149 OwnPtr<BitVector> m_countBits; |
| 146 }; | 150 }; |
| 147 | 151 |
| 148 } // namespace WebCore | 152 } // namespace WebCore |
| 149 | 153 |
| 150 #endif // UseCounter_h | 154 #endif // UseCounter_h |
| OLD | NEW |