| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 NET_REPORTING_REPORTING_ENDPOINT_MANAGER_H_ | 5 #ifndef NET_REPORTING_REPORTING_ENDPOINT_MANAGER_H_ |
| 6 #define NET_REPORTING_REPORTING_ENDPOINT_MANAGER_H_ | 6 #define NET_REPORTING_REPORTING_ENDPOINT_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class TickClock; | 22 class TickClock; |
| 23 } // namespace base | 23 } // namespace base |
| 24 | 24 |
| 25 namespace url { | 25 namespace url { |
| 26 class Origin; | 26 class Origin; |
| 27 } // namespace url | 27 } // namespace url |
| 28 | 28 |
| 29 namespace net { | 29 namespace net { |
| 30 | 30 |
| 31 class ReportingCache; | 31 class ReportingCache; |
| 32 class ReportingDelegate; |
| 32 struct ReportingPolicy; | 33 struct ReportingPolicy; |
| 33 | 34 |
| 34 // Keeps track of which endpoints are pending (have active delivery attempts to | 35 // Keeps track of which endpoints are pending (have active delivery attempts to |
| 35 // them) or in exponential backoff after one or more failures, and chooses an | 36 // them) or in exponential backoff after one or more failures, and chooses an |
| 36 // endpoint from an endpoint group to receive reports for an origin. | 37 // endpoint from an endpoint group to receive reports for an origin. |
| 37 class NET_EXPORT ReportingEndpointManager { | 38 class NET_EXPORT ReportingEndpointManager { |
| 38 public: | 39 public: |
| 39 // |context| must outlive the ReportingEndpointManager. | 40 // |context| must outlive the ReportingEndpointManager. |
| 40 ReportingEndpointManager(ReportingContext* context); | 41 ReportingEndpointManager(ReportingContext* context); |
| 41 ~ReportingEndpointManager(); | 42 ~ReportingEndpointManager(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 // Removes |endpoint| from the set of pending endpoints. | 61 // Removes |endpoint| from the set of pending endpoints. |
| 61 void ClearEndpointPending(const GURL& endpoint); | 62 void ClearEndpointPending(const GURL& endpoint); |
| 62 | 63 |
| 63 // Informs the EndpointManager of a successful or unsuccessful request made to | 64 // Informs the EndpointManager of a successful or unsuccessful request made to |
| 64 // |endpoint| so it can manage exponential backoff of failing endpoints. | 65 // |endpoint| so it can manage exponential backoff of failing endpoints. |
| 65 void InformOfEndpointRequest(const GURL& endpoint, bool succeeded); | 66 void InformOfEndpointRequest(const GURL& endpoint, bool succeeded); |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 const ReportingPolicy& policy() { return context_->policy(); } | 69 const ReportingPolicy& policy() { return context_->policy(); } |
| 69 base::TickClock* tick_clock() { return context_->tick_clock(); } | 70 base::TickClock* tick_clock() { return context_->tick_clock(); } |
| 71 ReportingDelegate* delegate() { return context_->delegate(); } |
| 70 ReportingCache* cache() { return context_->cache(); } | 72 ReportingCache* cache() { return context_->cache(); } |
| 71 | 73 |
| 72 ReportingContext* context_; | 74 ReportingContext* context_; |
| 73 | 75 |
| 74 std::set<GURL> pending_endpoints_; | 76 std::set<GURL> pending_endpoints_; |
| 75 | 77 |
| 76 // Note: Currently the ReportingBrowsingDataRemover does not clear this data | 78 // Note: Currently the ReportingBrowsingDataRemover does not clear this data |
| 77 // because it's not persisted to disk. If it's ever persisted, it will need | 79 // because it's not persisted to disk. If it's ever persisted, it will need |
| 78 // to be cleared as well. | 80 // to be cleared as well. |
| 79 std::map<GURL, std::unique_ptr<net::BackoffEntry>> endpoint_backoff_; | 81 std::map<GURL, std::unique_ptr<net::BackoffEntry>> endpoint_backoff_; |
| 80 | 82 |
| 81 DISALLOW_COPY_AND_ASSIGN(ReportingEndpointManager); | 83 DISALLOW_COPY_AND_ASSIGN(ReportingEndpointManager); |
| 82 }; | 84 }; |
| 83 | 85 |
| 84 } // namespace net | 86 } // namespace net |
| 85 | 87 |
| 86 #endif // NET_REPORTING_REPORTING_ENDPOINT_MANAGER_H_ | 88 #endif // NET_REPORTING_REPORTING_ENDPOINT_MANAGER_H_ |
| OLD | NEW |