Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: Source/core/page/UseCounter.cpp

Issue 44453002: Remove HistogramSupport abstraction layer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/PagePopupController.cpp ('k') | Source/core/platform/HistogramSupport.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 #include "config.h" 27 #include "config.h"
28 #include "core/page/UseCounter.h" 28 #include "core/page/UseCounter.h"
29 29
30 #include "core/css/CSSStyleSheet.h" 30 #include "core/css/CSSStyleSheet.h"
31 #include "core/css/StyleSheetContents.h" 31 #include "core/css/StyleSheetContents.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/ExecutionContext.h" 33 #include "core/dom/ExecutionContext.h"
34 #include "core/frame/DOMWindow.h" 34 #include "core/frame/DOMWindow.h"
35 #include "core/page/Page.h" 35 #include "core/page/Page.h"
36 #include "core/page/PageConsole.h" 36 #include "core/page/PageConsole.h"
37 #include "core/platform/HistogramSupport.h" 37 #include "public/platform/Platform.h"
38 #include "wtf/text/WTFString.h" 38 #include "wtf/text/WTFString.h"
39 39
40 namespace WebCore { 40 namespace WebCore {
41 41
42 static int totalPagesMeasuredCSSSampleId() { return 1; } 42 static int totalPagesMeasuredCSSSampleId() { return 1; }
43 43
44 // FIXME : This mapping should be autogenerated. This function should 44 // FIXME : This mapping should be autogenerated. This function should
45 // be moved to a separate file and a script run at build time 45 // be moved to a separate file and a script run at build time
46 // to detect new values in CSSPropertyID and add them to the 46 // to detect new values in CSSPropertyID and add them to the
47 // end of this function. This file would be checked in. 47 // end of this function. This file would be checked in.
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 522
523 UseCounter::UseCounter() 523 UseCounter::UseCounter()
524 { 524 {
525 m_CSSFeatureBits.ensureSize(lastCSSProperty + 1); 525 m_CSSFeatureBits.ensureSize(lastCSSProperty + 1);
526 m_CSSFeatureBits.clearAll(); 526 m_CSSFeatureBits.clearAll();
527 } 527 }
528 528
529 UseCounter::~UseCounter() 529 UseCounter::~UseCounter()
530 { 530 {
531 // We always log PageDestruction so that we have a scale for the rest of the features. 531 // We always log PageDestruction so that we have a scale for the rest of the features.
532 HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageDestru ction, NumberOfFeatures); 532 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureObserver", PageDestruction, NumberOfFeatures);
533 533
534 updateMeasurements(); 534 updateMeasurements();
535 } 535 }
536 536
537 void UseCounter::updateMeasurements() 537 void UseCounter::updateMeasurements()
538 { 538 {
539 HistogramSupport::histogramEnumeration("WebCore.FeatureObserver", PageVisits , NumberOfFeatures); 539 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureObserver", PageVisits, NumberOfFeatures);
540 540
541 if (m_countBits) { 541 if (m_countBits) {
542 for (unsigned i = 0; i < NumberOfFeatures; ++i) { 542 for (unsigned i = 0; i < NumberOfFeatures; ++i) {
543 if (m_countBits->quickGet(i)) 543 if (m_countBits->quickGet(i))
544 HistogramSupport::histogramEnumeration("WebCore.FeatureObserver" , i, NumberOfFeatures); 544 WebKit::Platform::current()->histogramEnumeration("WebCore.Featu reObserver", i, NumberOfFeatures);
545 } 545 }
546 // Clearing count bits is timing sensitive. 546 // Clearing count bits is timing sensitive.
547 m_countBits->clearAll(); 547 m_countBits->clearAll();
548 } 548 }
549 549
550 // FIXME: Sometimes this function is called more than once per page. The fol lowing 550 // FIXME: Sometimes this function is called more than once per page. The fol lowing
551 // bool guards against incrementing the page count when there are no CSS 551 // bool guards against incrementing the page count when there are no CSS
552 // bits set. http://crbug.com/236262. 552 // bits set. http://crbug.com/236262.
553 bool needsPagesMeasuredUpdate = false; 553 bool needsPagesMeasuredUpdate = false;
554 for (int i = firstCSSProperty; i <= lastCSSProperty; ++i) { 554 for (int i = firstCSSProperty; i <= lastCSSProperty; ++i) {
555 if (m_CSSFeatureBits.quickGet(i)) { 555 if (m_CSSFeatureBits.quickGet(i)) {
556 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i); 556 int cssSampleId = mapCSSPropertyIdToCSSSampleIdForHistogram(i);
557 HistogramSupport::histogramEnumeration("WebCore.FeatureObserver.CSSP roperties", cssSampleId, maximumCSSSampleId()); 557 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureOb server.CSSProperties", cssSampleId, maximumCSSSampleId());
558 needsPagesMeasuredUpdate = true; 558 needsPagesMeasuredUpdate = true;
559 } 559 }
560 } 560 }
561 561
562 if (needsPagesMeasuredUpdate) 562 if (needsPagesMeasuredUpdate)
563 HistogramSupport::histogramEnumeration("WebCore.FeatureObserver.CSSPrope rties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId()); 563 WebKit::Platform::current()->histogramEnumeration("WebCore.FeatureObserv er.CSSProperties", totalPagesMeasuredCSSSampleId(), maximumCSSSampleId());
564 564
565 m_CSSFeatureBits.clearAll(); 565 m_CSSFeatureBits.clearAll();
566 } 566 }
567 567
568 void UseCounter::didCommitLoad() 568 void UseCounter::didCommitLoad()
569 { 569 {
570 updateMeasurements(); 570 updateMeasurements();
571 } 571 }
572 572
573 void UseCounter::count(const Document& document, Feature feature) 573 void UseCounter::count(const Document& document, Feature feature)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) 722 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents)
723 { 723 {
724 // FIXME: We may want to handle stylesheets that have multiple owners 724 // FIXME: We may want to handle stylesheets that have multiple owners
725 // http://crbug.com/242125 725 // http://crbug.com/242125
726 if (sheetContents && !sheetContents->isUserStyleSheet() && sheetContents->ha sSingleOwnerNode()) 726 if (sheetContents && !sheetContents->isUserStyleSheet() && sheetContents->ha sSingleOwnerNode())
727 return getFrom(sheetContents->singleOwnerDocument()); 727 return getFrom(sheetContents->singleOwnerDocument());
728 return 0; 728 return 0;
729 } 729 }
730 730
731 } // namespace WebCore 731 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/PagePopupController.cpp ('k') | Source/core/platform/HistogramSupport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698