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

Unified Diff: third_party/WebKit/Source/core/frame/UseCounter.h

Issue 2796283005: Adding UseCounter specific for extensions (Closed)
Patch Set: Codereview: added tester ExpectTotalCountExcept to simplify UseCounter unit tests Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/UseCounter.h
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index 88f37a8c0dc938d087a2103a172eb01a2aa1dca8..6a06d43f06372e76ee61daacfae2c38df7798ce0 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -67,7 +67,12 @@ class CORE_EXPORT UseCounter {
enum Context {
kDefaultContext,
// Counters for SVGImages (lifetime independent from other pages).
- kSVGImageContext
+ kSVGImageContext,
+ // Counters for extensions.
+ kExtensionContext,
+ // Context when counters should be disabled (eg, internal pages such as
+ // about, chrome-devtools, etc).
+ kDisabledContext
};
UseCounter(Context = kDefaultContext);
@@ -1587,8 +1592,8 @@ class CORE_EXPORT UseCounter {
};
// An interface to observe UseCounter changes. Note that this is never
- // notified when the counter is disabled by |m_muteCount| or
- // |m_disableReporting|.
+ // notified when the counter is disabled by |m_muteCount| or when |m_context|
+ // is DisabledContext.
class Observer : public GarbageCollected<Observer> {
public:
// Notified when a feature is counted for the first time. This should return
@@ -1650,8 +1655,8 @@ class CORE_EXPORT UseCounter {
private:
// Notifies that a feature is newly counted to |m_observers|. This shouldn't
- // be called when the counter is disabled by |m_muteCount| or
- // |m_disableReporting|.
+ // be called when the counter is disabled by |m_muteCount| or when |m_context|
+ // if DisabledContext.
void NotifyFeatureCounted(Feature);
EnumerationHistogram& FeaturesHistogram() const;
@@ -1661,10 +1666,8 @@ class CORE_EXPORT UseCounter {
// If non-zero, ignore all 'count' calls completely.
unsigned mute_count_;
- // If true, disable reporting all histogram entries.
- bool disable_reporting_;
-
- // The scope represented by this UseCounter instance.
+ // The scope represented by this UseCounter instance, which must be fixed for
+ // the duration of a page but can change when a new page is loaded.
Context context_;
// Track what features/properties have been reported to the (non-legacy)

Powered by Google App Engine
This is Rietveld 408576698