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

Side by Side Diff: Source/core/frame/UseCounter.h

Issue 1315783003: Make classes and structures in core/frame fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 months 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
« no previous file with comments | « Source/core/frame/TopControls.h ('k') | Source/core/frame/csp/CSPSource.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 * 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // features are used and thus when it's safe to remove or change them. 49 // features are used and thus when it's safe to remove or change them.
50 // 50 //
51 // The Chromium Content layer controls what is done with this data. 51 // The Chromium Content layer controls what is done with this data.
52 // For instance, in Google Chrome, these counts are submitted 52 // For instance, in Google Chrome, these counts are submitted
53 // anonymously through the Histogram recording system in Chrome 53 // anonymously through the Histogram recording system in Chrome
54 // for users who opt-in to "Usage Statistics" submission 54 // for users who opt-in to "Usage Statistics" submission
55 // during their install of Google Chrome: 55 // during their install of Google Chrome:
56 // http://www.google.com/chrome/intl/en/privacy.html 56 // http://www.google.com/chrome/intl/en/privacy.html
57 57
58 class CORE_EXPORT UseCounter { 58 class CORE_EXPORT UseCounter {
59 DISALLOW_ALLOCATION();
59 WTF_MAKE_NONCOPYABLE(UseCounter); 60 WTF_MAKE_NONCOPYABLE(UseCounter);
60 public: 61 public:
61 UseCounter(); 62 UseCounter();
62 ~UseCounter(); 63 ~UseCounter();
63 64
64 enum Feature { 65 enum Feature {
65 // Do not change assigned numbers of existing items: add new features 66 // Do not change assigned numbers of existing items: add new features
66 // to the end of the list. 67 // to the end of the list.
67 PageDestruction = 0, 68 PageDestruction = 0,
68 PrefixedIndexedDB = 3, 69 PrefixedIndexedDB = 3,
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 static UseCounter* getFrom(const Document*); 884 static UseCounter* getFrom(const Document*);
884 static UseCounter* getFrom(const CSSStyleSheet*); 885 static UseCounter* getFrom(const CSSStyleSheet*);
885 static UseCounter* getFrom(const StyleSheetContents*); 886 static UseCounter* getFrom(const StyleSheetContents*);
886 887
887 static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id); 888 static int mapCSSPropertyIdToCSSSampleIdForHistogram(int id);
888 889
889 static void muteForInspector(); 890 static void muteForInspector();
890 static void unmuteForInspector(); 891 static void unmuteForInspector();
891 892
892 class CountBits { 893 class CountBits {
894 DISALLOW_ALLOCATION();
893 public: 895 public:
894 CountBits() : m_bits(NumberOfFeatures) { } 896 CountBits() : m_bits(NumberOfFeatures) { }
895 897
896 bool hasRecordedMeasurement(Feature feature) const 898 bool hasRecordedMeasurement(Feature feature) const
897 { 899 {
898 if (UseCounter::m_muteCount) 900 if (UseCounter::m_muteCount)
899 return false; 901 return false;
900 ASSERT(feature != PageDestruction); // PageDestruction is reserved a s a scaling factor. 902 ASSERT(feature != PageDestruction); // PageDestruction is reserved a s a scaling factor.
901 ASSERT(feature < NumberOfFeatures); 903 ASSERT(feature < NumberOfFeatures);
902 904
(...skipping 25 matching lines...) Expand all
928 930
929 bool hasRecordedMeasurement(Feature feature) const { return m_countBits.hasR ecordedMeasurement(feature); } 931 bool hasRecordedMeasurement(Feature feature) const { return m_countBits.hasR ecordedMeasurement(feature); }
930 932
931 CountBits m_countBits; 933 CountBits m_countBits;
932 BitVector m_CSSFeatureBits; 934 BitVector m_CSSFeatureBits;
933 }; 935 };
934 936
935 } // namespace blink 937 } // namespace blink
936 938
937 #endif // UseCounter_h 939 #endif // UseCounter_h
OLDNEW
« no previous file with comments | « Source/core/frame/TopControls.h ('k') | Source/core/frame/csp/CSPSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698