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

Side by Side Diff: components/domain_reliability/context.h

Issue 2289763003: Remove stl_util use from domain_reliability. (Closed)
Patch Set: win Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_
6 #define COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ 6 #define COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <deque> 10 #include <deque>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void GetQueuedBeaconsForTesting( 76 void GetQueuedBeaconsForTesting(
77 std::vector<const DomainReliabilityBeacon*>* beacons_out) const; 77 std::vector<const DomainReliabilityBeacon*>* beacons_out) const;
78 78
79 const DomainReliabilityConfig& config() const { return *config_.get(); } 79 const DomainReliabilityConfig& config() const { return *config_.get(); }
80 80
81 // Maximum number of beacons queued per context; if more than this many are 81 // Maximum number of beacons queued per context; if more than this many are
82 // queued; the oldest beacons will be removed. 82 // queued; the oldest beacons will be removed.
83 static const size_t kMaxQueuedBeacons; 83 static const size_t kMaxQueuedBeacons;
84 84
85 private: 85 private:
86 // Deque of beacons owned by this context. (Deleted after uploading.)
87 typedef std::deque<DomainReliabilityBeacon*> BeaconDeque;
88
89 void ScheduleUpload(base::TimeDelta min_delay, base::TimeDelta max_delay); 86 void ScheduleUpload(base::TimeDelta min_delay, base::TimeDelta max_delay);
90 void StartUpload(); 87 void StartUpload();
91 void OnUploadComplete(const DomainReliabilityUploader::UploadResult& result); 88 void OnUploadComplete(const DomainReliabilityUploader::UploadResult& result);
92 89
93 std::unique_ptr<const base::Value> CreateReport( 90 std::unique_ptr<const base::Value> CreateReport(
94 base::TimeTicks upload_time, 91 base::TimeTicks upload_time,
95 const GURL& collector_url, 92 const GURL& collector_url,
96 int* max_beacon_depth_out) const; 93 int* max_beacon_depth_out) const;
97 94
98 // Remembers the current state of the context when an upload starts. Can be 95 // Remembers the current state of the context when an upload starts. Can be
(...skipping 11 matching lines...) Expand all
110 // when there are too many beacons queued.) 107 // when there are too many beacons queued.)
111 void RemoveOldestBeacon(); 108 void RemoveOldestBeacon();
112 109
113 std::unique_ptr<const DomainReliabilityConfig> config_; 110 std::unique_ptr<const DomainReliabilityConfig> config_;
114 MockableTime* time_; 111 MockableTime* time_;
115 const std::string& upload_reporter_string_; 112 const std::string& upload_reporter_string_;
116 DomainReliabilityScheduler scheduler_; 113 DomainReliabilityScheduler scheduler_;
117 DomainReliabilityDispatcher* dispatcher_; 114 DomainReliabilityDispatcher* dispatcher_;
118 DomainReliabilityUploader* uploader_; 115 DomainReliabilityUploader* uploader_;
119 116
120 BeaconDeque beacons_; 117 std::deque<std::unique_ptr<DomainReliabilityBeacon>> beacons_;
121 size_t uploading_beacons_size_; 118 size_t uploading_beacons_size_;
122 base::TimeTicks upload_time_; 119 base::TimeTicks upload_time_;
123 base::TimeTicks last_upload_time_; 120 base::TimeTicks last_upload_time_;
124 // The last network change time is not tracked per-context, so this is a 121 // The last network change time is not tracked per-context, so this is a
125 // pointer to that value in a wider (e.g. per-Monitor or unittest) scope. 122 // pointer to that value in a wider (e.g. per-Monitor or unittest) scope.
126 const base::TimeTicks* last_network_change_time_; 123 const base::TimeTicks* last_network_change_time_;
127 124
128 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_; 125 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_;
129 126
130 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext); 127 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext);
131 }; 128 };
132 129
133 } // namespace domain_reliability 130 } // namespace domain_reliability
134 131
135 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ 132 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | components/domain_reliability/context.cc » ('j') | components/domain_reliability/dispatcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698