| 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 <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 DomainReliabilityDispatcher* dispatcher, | 36 DomainReliabilityDispatcher* dispatcher, |
| 37 DomainReliabilityUploader* uploader, | 37 DomainReliabilityUploader* uploader, |
| 38 scoped_ptr<const DomainReliabilityConfig> config); | 38 scoped_ptr<const DomainReliabilityConfig> config); |
| 39 ~DomainReliabilityContext(); | 39 ~DomainReliabilityContext(); |
| 40 | 40 |
| 41 // Notifies the context of a beacon on its domain(s); may or may not save the | 41 // Notifies the context of a beacon on its domain(s); may or may not save the |
| 42 // actual beacon to be uploaded, depending on the sample rates in the config, | 42 // actual beacon to be uploaded, depending on the sample rates in the config, |
| 43 // but will increment one of the request counters in any case. | 43 // but will increment one of the request counters in any case. |
| 44 void OnBeacon(const GURL& url, const DomainReliabilityBeacon& beacon); | 44 void OnBeacon(const GURL& url, const DomainReliabilityBeacon& beacon); |
| 45 | 45 |
| 46 // Called to clear browsing data, since beacons are like browsing history. |
| 47 void ClearBeacons(); |
| 48 |
| 46 void GetQueuedDataForTesting( | 49 void GetQueuedDataForTesting( |
| 47 size_t resource_index, | 50 size_t resource_index, |
| 48 std::vector<DomainReliabilityBeacon>* beacons_out, | 51 std::vector<DomainReliabilityBeacon>* beacons_out, |
| 49 uint32* successful_requests_out, | 52 uint32* successful_requests_out, |
| 50 uint32* failed_requests_out) const; | 53 uint32* failed_requests_out) const; |
| 51 | 54 |
| 52 const DomainReliabilityConfig& config() { return *config_.get(); } | 55 const DomainReliabilityConfig& config() { return *config_.get(); } |
| 53 | 56 |
| 54 // Maximum number of beacons queued per context; if more than this many are | 57 // Maximum number of beacons queued per context; if more than this many are |
| 55 // queued; the oldest beacons will be removed. | 58 // queued; the oldest beacons will be removed. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 base::TimeTicks last_upload_time_; | 102 base::TimeTicks last_upload_time_; |
| 100 | 103 |
| 101 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_; | 104 base::WeakPtrFactory<DomainReliabilityContext> weak_factory_; |
| 102 | 105 |
| 103 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext); | 106 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityContext); |
| 104 }; | 107 }; |
| 105 | 108 |
| 106 } // namespace domain_reliability | 109 } // namespace domain_reliability |
| 107 | 110 |
| 108 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ | 111 #endif // COMPONENTS_DOMAIN_RELIABILITY_CONTEXT_H_ |
| OLD | NEW |