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

Unified Diff: components/domain_reliability/context.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/context.h
diff --git a/components/domain_reliability/context.h b/components/domain_reliability/context.h
index 528c8ab168721174099e89acf9c9b4acaac63621..5b91e1e023d88ea5e8926834f9070b829d66b096 100644
--- a/components/domain_reliability/context.h
+++ b/components/domain_reliability/context.h
@@ -53,7 +53,7 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext {
// Notifies the context of a beacon on its domain(s); may or may not save the
// actual beacon to be uploaded, depending on the sample rates in the config,
// but will increment one of the request counters in any case.
- void OnBeacon(const GURL& url, const DomainReliabilityBeacon& beacon);
+ void OnBeacon(scoped_ptr<DomainReliabilityBeacon> beacon);
// Called to clear browsing data, since beacons are like browsing history.
void ClearBeacons();
@@ -62,13 +62,11 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext {
// debugging purposes.
scoped_ptr<base::Value> GetWebUIData() const;
+ // Gets the beacons queued for upload in this context. |beacons_out| will be
Randy Smith (Not in Mondays) 2015/10/29 22:36:11 nit: |*beacons_out|.
Deprecated (see juliatuttle) 2015/11/02 23:19:30 Done.
+ // cleared and filled with pointers to the beacons; the pointers remain valid
+ // as long as no other requests are reported to the DomainReliabilityMonitor.
Randy Smith (Not in Mondays) 2015/10/29 22:36:11 nit, suggestion: These lifetime related requiremen
Deprecated (see juliatuttle) 2015/11/02 23:19:30 Would you be okay if I punted this to another CL t
Randy Smith (Not in Mondays) 2015/11/03 21:48:12 Sure.
void GetQueuedBeaconsForTesting(
- std::vector<DomainReliabilityBeacon>* beacons_out) const;
-
- void GetRequestCountsForTesting(
- size_t resource_index,
- uint32* successful_requests_out,
- uint32* failed_requests_out) const;
+ std::vector<const DomainReliabilityBeacon*>* beacons_out) const;
const DomainReliabilityConfig& config() const { return *config_.get(); }
@@ -77,18 +75,14 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext {
static const size_t kMaxQueuedBeacons;
private:
- class ResourceState;
-
- typedef std::deque<DomainReliabilityBeacon> BeaconDeque;
- typedef ScopedVector<ResourceState> ResourceStateVector;
- typedef ResourceStateVector::const_iterator ResourceStateIterator;
+ typedef std::deque<DomainReliabilityBeacon*> BeaconDeque;
- void InitializeResourceStates();
void ScheduleUpload(base::TimeDelta min_delay, base::TimeDelta max_delay);
void StartUpload();
void OnUploadComplete(const DomainReliabilityUploader::UploadResult& result);
- scoped_ptr<const base::Value> CreateReport(base::TimeTicks upload_time) const;
+ scoped_ptr<const base::Value> CreateReport(base::TimeTicks upload_time,
+ const GURL& collector_url) const;
// Remembers the current state of the context when an upload starts. Can be
// called multiple times in a row (without |CommitUpload|) if uploads fail
@@ -114,9 +108,6 @@ class DOMAIN_RELIABILITY_EXPORT DomainReliabilityContext {
BeaconDeque beacons_;
size_t uploading_beacons_size_;
- // Each ResourceState in |states_| corresponds to the Resource of the same
- // index in the config.
- ResourceStateVector states_;
base::TimeTicks upload_time_;
base::TimeTicks last_upload_time_;
// The last network change time is not tracked per-context, so this is a

Powered by Google App Engine
This is Rietveld 408576698