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

Unified Diff: components/domain_reliability/config.h

Issue 1180223006: Domain Reliability: Simplify configs and reports (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, make requested changes Created 5 years, 2 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/domain_reliability/config.h
diff --git a/components/domain_reliability/config.h b/components/domain_reliability/config.h
index ba32038b7c2b5ae91c666bd274e4b5e5e76d0160..8bbbe34cf22d5f834fc144023e3d88389873055c 100644
--- a/components/domain_reliability/config.h
+++ b/components/domain_reliability/config.h
@@ -23,68 +23,6 @@ namespace domain_reliability {
// with what frequency, and where the beacons are uploaded.
class DOMAIN_RELIABILITY_EXPORT DomainReliabilityConfig {
Randy Smith (Not in Mondays) 2015/10/29 22:36:10 This looks more like a struct than a class to me.
Deprecated (see juliatuttle) 2015/11/02 23:19:30 Done.
public:
- static const size_t kInvalidResourceIndex;
-
- // A particular resource named in the config -- includes a set of URL
- // patterns that the resource will match, along with sample rates for
- // successful and unsuccessful requests.
- class DOMAIN_RELIABILITY_EXPORT Resource {
- public:
- Resource();
- ~Resource();
-
- // Returns whether |url_string| matches at least one of the |url_patterns|
- // in this Resource.
- bool MatchesUrl(const GURL& url) const;
-
- // Returns whether a request (that was successful if |success| is true)
- // should be reported with a full beacon. (The output is non-deterministic;
- // it |success_sample_rate| or |failure_sample_rate| to a random number.)
- bool DecideIfShouldReportRequest(bool success) const;
-
- // Registers with the JSONValueConverter so it will know how to convert the
- // JSON for a named resource into the struct.
- static void RegisterJSONConverter(
- base::JSONValueConverter<Resource>* converter);
-
- bool IsValid() const;
-
- // Name of the Resource, as will be reported in uploads.
- std::string name;
-
- // List of URL patterns to assign requests to this Resource.
- ScopedVector<std::string> url_patterns;
-
- // Sample rates for successful and unsuccessful requests, respectively.
- // 0.0 reports no requests, and 1.0 reports every request.
- double success_sample_rate;
- double failure_sample_rate;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Resource);
- };
-
- // A particular endpoint for report uploads. Includes the URL to upload
- // reports to. May include a verification URL or backoff/load management
- // configuration in the future.
- struct DOMAIN_RELIABILITY_EXPORT Collector {
- public:
- Collector();
- ~Collector();
-
- // Registers with the JSONValueConverter so it will know how to convert the
- // JSON for a collector into the struct.
- static void RegisterJSONConverter(
- base::JSONValueConverter<Collector>* converter);
-
- bool IsValid() const;
-
- GURL upload_url;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Collector);
- };
-
DomainReliabilityConfig();
~DomainReliabilityConfig();
@@ -94,20 +32,20 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityConfig {
bool IsValid() const;
- // Finds the index (in resources) of the first Resource that matches a
- // particular URL. Returns kInvalidResourceIndex if it is not matched by any
- // Resources.
- size_t GetResourceIndexForUrl(const GURL& url) const;
+ bool DecideIfShouldReportRequest(bool success) const;
// Registers with the JSONValueConverter so it will know how to convert the
// JSON for a config into the struct.
static void RegisterJSONConverter(
base::JSONValueConverter<DomainReliabilityConfig>* converter);
- std::string version;
- std::string domain;
- ScopedVector<Resource> resources;
- ScopedVector<Collector> collectors;
+ GURL origin;
+ bool include_subdomains;
+ ScopedVector<GURL> collectors;
+
+ double success_sample_rate;
+ double failure_sample_rate;
+ ScopedVector<std::string> path_prefixes;
private:
DISALLOW_COPY_AND_ASSIGN(DomainReliabilityConfig);

Powered by Google App Engine
This is Rietveld 408576698