OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright (C) 2012 Google, Inc. All rights reserved. | 3 * Copyright (C) 2012 Google, Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 UseCounter::UseCounter() | 521 UseCounter::UseCounter() |
522 { | 522 { |
523 m_CSSFeatureBits.ensureSize(lastCSSProperty + 1); | 523 m_CSSFeatureBits.ensureSize(lastCSSProperty + 1); |
524 m_CSSFeatureBits.clearAll(); | 524 m_CSSFeatureBits.clearAll(); |
525 } | 525 } |
526 | 526 |
527 UseCounter::~UseCounter() | 527 UseCounter::~UseCounter() |
528 { | 528 { |
529 // We always log PageDestruction so that we have a scale for the rest of the
features. | 529 // We always log PageDestruction so that we have a scale for the rest of the
features. |
530 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureObserver",
PageDestruction, NumberOfFeatures); | 530 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObserver",
PageDestruction, NumberOfFeatures); |
531 | 531 |
532 updateMeasurements(); | 532 updateMeasurements(); |
533 } | 533 } |
534 | 534 |
535 void UseCounter::updateMeasurements() | 535 void UseCounter::updateMeasurements() |
536 { | 536 { |
537 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureObserver",
PageVisits, NumberOfFeatures); | 537 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObserver",
PageVisits, NumberOfFeatures); |
538 | 538 |
539 if (m_countBits) { | 539 if (m_countBits) { |
540 for (unsigned i = 0; i < NumberOfFeatures; ++i) { | 540 for (unsigned i = 0; i < NumberOfFeatures; ++i) { |
541 if (m_countBits->quickGet(i)) | 541 if (m_countBits->quickGet(i)) |
542 WebKit::Platform::current()->histogramEnumeration("WebCore.Featu
reObserver", i, NumberOfFeatures); | 542 blink::Platform::current()->histogramEnumeration("WebCore.Featur
eObserver", i, NumberOfFeatures); |
543 } | 543 } |
544 // Clearing count bits is timing sensitive. | 544 // Clearing count bits is timing sensitive. |
545 m_countBits->clearAll(); | 545 m_countBits->clearAll(); |
546 } | 546 } |
547 | 547 |
548 // FIXME: Sometimes this function is called more than once per page. The fol
lowing | 548 // FIXME: Sometimes this function is called more than once per page. The fol
lowing |
549 // bool guards against incrementing the page count when there are no
CSS | 549 // bool guards against incrementing the page count when there are no
CSS |
550 // bits set. http://crbug.com/236262. | 550 // bits set. http://crbug.com/236262. |
551 bool needsPagesMeasuredUpdate = false; | 551 bool needsPagesMeasuredUpdate = false; |
552 for (int i = firstCSSProperty; i <= lastCSSProperty; ++i) { | 552 for (int i = firstCSSProperty; i <= lastCSSProperty; ++i) { |
553 if (m_CSSFeatureBits.quickGet(i)) { | 553 if (m_CSSFeatureBits.quickGet(i)) { |
554 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i); | 554 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i); |
555 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureOb
server.CSSProperties", cssSampleId, maximumCSSSampleId()); | 555 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObs
erver.CSSProperties", cssSampleId, maximumCSSSampleId()); |
556 needsPagesMeasuredUpdate = true; | 556 needsPagesMeasuredUpdate = true; |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 if (needsPagesMeasuredUpdate) | 560 if (needsPagesMeasuredUpdate) |
561 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureObserv
er.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId()); | 561 blink::Platform::current()->histogramEnumeration("WebCore.FeatureObserve
r.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId()); |
562 | 562 |
563 m_CSSFeatureBits.clearAll(); | 563 m_CSSFeatureBits.clearAll(); |
564 } | 564 } |
565 | 565 |
566 void UseCounter::didCommitLoad() | 566 void UseCounter::didCommitLoad() |
567 { | 567 { |
568 updateMeasurements(); | 568 updateMeasurements(); |
569 } | 569 } |
570 | 570 |
571 void UseCounter::count(const Document& document, Feature feature) | 571 void UseCounter::count(const Document& document, Feature feature) |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 723 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
724 { | 724 { |
725 // FIXME: We may want to handle stylesheets that have multiple owners | 725 // FIXME: We may want to handle stylesheets that have multiple owners |
726 // http://crbug.com/242125 | 726 // http://crbug.com/242125 |
727 if (sheetContents && !sheetContents->isUserStyleSheet() && sheetContents->ha
sSingleOwnerNode()) | 727 if (sheetContents && !sheetContents->isUserStyleSheet() && sheetContents->ha
sSingleOwnerNode()) |
728 return getFrom(sheetContents->singleOwnerDocument()); | 728 return getFrom(sheetContents->singleOwnerDocument()); |
729 return 0; | 729 return 0; |
730 } | 730 } |
731 | 731 |
732 } // namespace WebCore | 732 } // namespace WebCore |
OLD | NEW |