| 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 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 | 1092 |
| 1093 ASSERT_NOT_REACHED(); | 1093 ASSERT_NOT_REACHED(); |
| 1094 return 0; | 1094 return 0; |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 UseCounter::UseCounter(Context context) | 1097 UseCounter::UseCounter(Context context) |
| 1098 : m_muteCount(0), | 1098 : m_muteCount(0), |
| 1099 m_disableReporting(false), | 1099 m_disableReporting(false), |
| 1100 m_context(context), | 1100 m_context(context), |
| 1101 m_featuresRecorded(NumberOfFeatures), | 1101 m_featuresRecorded(NumberOfFeatures), |
| 1102 m_CSSRecorded(lastUnresolvedCSSProperty + 1) {} | 1102 m_CSSRecorded(numCSSPropertyIDs) {} |
| 1103 | 1103 |
| 1104 void UseCounter::muteForInspector() { | 1104 void UseCounter::muteForInspector() { |
| 1105 m_muteCount++; | 1105 m_muteCount++; |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 void UseCounter::unmuteForInspector() { | 1108 void UseCounter::unmuteForInspector() { |
| 1109 m_muteCount--; | 1109 m_muteCount--; |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 void UseCounter::recordMeasurement(Feature feature) { | 1112 void UseCounter::recordMeasurement(Feature feature) { |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 */ | 1305 */ |
| 1306 | 1306 |
| 1307 static EnumerationHistogram& featureObserverHistogram() { | 1307 static EnumerationHistogram& featureObserverHistogram() { |
| 1308 DEFINE_STATIC_LOCAL( | 1308 DEFINE_STATIC_LOCAL( |
| 1309 EnumerationHistogram, histogram, | 1309 EnumerationHistogram, histogram, |
| 1310 ("WebCore.FeatureObserver", UseCounter::NumberOfFeatures)); | 1310 ("WebCore.FeatureObserver", UseCounter::NumberOfFeatures)); |
| 1311 return histogram; | 1311 return histogram; |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 UseCounter::LegacyCounter::LegacyCounter() | 1314 UseCounter::LegacyCounter::LegacyCounter() |
| 1315 : m_featureBits(NumberOfFeatures), | 1315 : m_featureBits(NumberOfFeatures), m_CSSBits(numCSSPropertyIDs) {} |
| 1316 m_CSSBits(lastUnresolvedCSSProperty + 1) {} | |
| 1317 | 1316 |
| 1318 UseCounter::LegacyCounter::~LegacyCounter() { | 1317 UseCounter::LegacyCounter::~LegacyCounter() { |
| 1319 // PageDestruction was intended to be used as a scale, but it's broken (due to | 1318 // PageDestruction was intended to be used as a scale, but it's broken (due to |
| 1320 // fast shutdown). See https://crbug.com/597963. | 1319 // fast shutdown). See https://crbug.com/597963. |
| 1321 featureObserverHistogram().count(OBSOLETE_PageDestruction); | 1320 featureObserverHistogram().count(OBSOLETE_PageDestruction); |
| 1322 updateMeasurements(); | 1321 updateMeasurements(); |
| 1323 } | 1322 } |
| 1324 | 1323 |
| 1325 void UseCounter::LegacyCounter::countFeature(Feature feature) { | 1324 void UseCounter::LegacyCounter::countFeature(Feature feature) { |
| 1326 m_featureBits.quickSet(feature); | 1325 m_featureBits.quickSet(feature); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1340 // Clearing count bits is timing sensitive. | 1339 // Clearing count bits is timing sensitive. |
| 1341 m_featureBits.clearAll(); | 1340 m_featureBits.clearAll(); |
| 1342 | 1341 |
| 1343 // FIXME: Sometimes this function is called more than once per page. The | 1342 // FIXME: Sometimes this function is called more than once per page. The |
| 1344 // following bool guards against incrementing the page count when there are no | 1343 // following bool guards against incrementing the page count when there are no |
| 1345 // CSS bits set. https://crbug.com/236262. | 1344 // CSS bits set. https://crbug.com/236262. |
| 1346 DEFINE_STATIC_LOCAL( | 1345 DEFINE_STATIC_LOCAL( |
| 1347 EnumerationHistogram, cssPropertiesHistogram, | 1346 EnumerationHistogram, cssPropertiesHistogram, |
| 1348 ("WebCore.FeatureObserver.CSSProperties", kMaximumCSSSampleId)); | 1347 ("WebCore.FeatureObserver.CSSProperties", kMaximumCSSSampleId)); |
| 1349 bool needsPagesMeasuredUpdate = false; | 1348 bool needsPagesMeasuredUpdate = false; |
| 1350 for (size_t i = firstCSSProperty; i <= lastUnresolvedCSSProperty; ++i) { | 1349 for (size_t i = firstCSSProperty; i < numCSSPropertyIDs; ++i) { |
| 1351 if (m_CSSBits.quickGet(i)) { | 1350 if (m_CSSBits.quickGet(i)) { |
| 1352 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram( | 1351 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram( |
| 1353 static_cast<CSSPropertyID>(i)); | 1352 static_cast<CSSPropertyID>(i)); |
| 1354 cssPropertiesHistogram.count(cssSampleId); | 1353 cssPropertiesHistogram.count(cssSampleId); |
| 1355 needsPagesMeasuredUpdate = true; | 1354 needsPagesMeasuredUpdate = true; |
| 1356 } | 1355 } |
| 1357 } | 1356 } |
| 1358 | 1357 |
| 1359 if (needsPagesMeasuredUpdate) | 1358 if (needsPagesMeasuredUpdate) |
| 1360 cssPropertiesHistogram.count(totalPagesMeasuredCSSSampleId()); | 1359 cssPropertiesHistogram.count(totalPagesMeasuredCSSSampleId()); |
| 1361 | 1360 |
| 1362 m_CSSBits.clearAll(); | 1361 m_CSSBits.clearAll(); |
| 1363 } | 1362 } |
| 1364 | 1363 |
| 1365 } // namespace blink | 1364 } // namespace blink |
| OLD | NEW |