| OLD | NEW |
| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // Uses the state remembered by |MarkUpload| to remove successfully uploaded | 103 // Uses the state remembered by |MarkUpload| to remove successfully uploaded |
| 104 // data but keep beacons and request counts added after the upload started. | 104 // data but keep beacons and request counts added after the upload started. |
| 105 void CommitUpload(); | 105 void CommitUpload(); |
| 106 | 106 |
| 107 void RollbackUpload(); | 107 void RollbackUpload(); |
| 108 | 108 |
| 109 // Finds and removes the oldest beacon. DCHECKs if there is none. (Called | 109 // Finds and removes the oldest beacon. DCHECKs if there is none. (Called |
| 110 // when there are too many beacons queued.) | 110 // when there are too many beacons queued.) |
| 111 void RemoveOldestBeacon(); | 111 void RemoveOldestBeacon(); |
| 112 | 112 |
| 113 void RemoveExpiredBeacons(); |
| 114 |
| 113 std::unique_ptr<const DomainReliabilityConfig> config_; | 115 std::unique_ptr<const DomainReliabilityConfig> config_; |
| 114 MockableTime* time_; | 116 MockableTime* time_; |
| 115 const std::string& upload_reporter_string_; | 117 const std::string& upload_reporter_string_; |
| 116 DomainReliabilityScheduler scheduler_; | 118 DomainReliabilityScheduler scheduler_; |
| 117 DomainReliabilityDispatcher* dispatcher_; | 119 DomainReliabilityDispatcher* dispatcher_; |
| 118 DomainReliabilityUploader* uploader_; | 120 DomainReliabilityUploader* uploader_; |
| 119 | 121 |
| 120 std::deque<std::unique_ptr<DomainReliabilityBeacon>> beacons_; | 122 std::deque<std::unique_ptr<DomainReliabilityBeacon>> beacons_; |
| 121 size_t uploading_beacons_size_; | 123 size_t uploading_beacons_size_; |
| 122 base::TimeTicks upload_time_; | 124 base::TimeTicks upload_time_; |
| 123 base::TimeTicks last_upload_time_; | 125 base::TimeTicks last_upload_time_; |
| 124 // The last network change time is not tracked per-context, so this is a | 126 // 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. | 127 // pointer to that value in a wider (e.g. per-Monitor or unittest) scope. |
| 126 const base::TimeTicks* last_network_change_time_; | 128 const base::TimeTicks* last_network_change_time_; |
| 127 | 129 |
| 128 base::TimeTicks last_queued_beacon_time_; | 130 base::TimeTicks last_queued_beacon_time_; |
| 129 | 131 |
| 130 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_; | 132 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_; |
| 131 | 133 |
| 132 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext); | 134 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext); |
| 133 }; | 135 }; |
| 134 | 136 |
| 135 } // namespace domain_reliability | 137 } // namespace domain_reliability |
| 136 | 138 |
| 137 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ | 139 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ |
| OLD | NEW |