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

Unified Diff: components/ntp_snippets/request_throttler.h

Issue 2162533002: Adding a request counter to the snippets fetcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@traffic-monitor
Patch Set: Bernhard's comments Created 4 years, 5 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: components/ntp_snippets/request_throttler.h
diff --git a/components/ntp_snippets/request_throttler.h b/components/ntp_snippets/request_throttler.h
index f908825814b62fcb0790aca1a1a2702aeb91013f..a81bcdac9f632b46e7c64962bb964e09d97bfe08 100644
--- a/components/ntp_snippets/request_throttler.h
+++ b/components/ntp_snippets/request_throttler.h
@@ -18,8 +18,6 @@ class HistogramBase;
namespace ntp_snippets {
-struct RequestTypeInfo;
-
// Counts requests to external services, compares them to a daily quota, reports
// them to UMA. In the application code, create one local instance for each type
// of requests, identified by the RequestType. The request counter is based on:
@@ -45,9 +43,7 @@ class RequestThrottler {
CONTENT_SUGGESTION_FETCHER
};
- RequestThrottler(PrefService* pref_service,
- RequestType type,
- int default_quota);
+ RequestThrottler(PrefService* pref_service, RequestType type);
// Registers profile prefs for all RequestTypes. Called from browser_prefs.cc.
static void RegisterProfilePrefs(PrefRegistrySimple* registry);
@@ -59,6 +55,13 @@ class RequestThrottler {
bool DemandQuotaForRequest(bool force_request);
private:
+ friend class RequestThrottlerTest;
+ // Used internally for working with a RequestType.
+ struct RequestTypeInfo;
+
+ // The array of info entries - one per each RequestType.
+ static const RequestTypeInfo kRequestTypeInfo[];
+
// Also emits the PerDay histogram if the day changed.
void ResetCounterIfDayChanged();
« no previous file with comments | « components/ntp_snippets/ntp_snippets_service_unittest.cc ('k') | components/ntp_snippets/request_throttler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698