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 #include "net/reporting/reporting_policy.h" | 5 #include "net/reporting/reporting_policy.h" |
6 | 6 |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 ReportingPolicy::ReportingPolicy() | 11 ReportingPolicy::ReportingPolicy() |
12 : delivery_interval(base::TimeDelta::FromMinutes(1)), | 12 : delivery_interval(base::TimeDelta::FromMinutes(1)), |
13 persistence_interval(base::TimeDelta::FromMinutes(1)), | 13 persistence_interval(base::TimeDelta::FromMinutes(1)), |
14 persist_reports_across_restarts(false), | 14 persist_reports_across_restarts(false), |
15 persist_clients_across_restarts(true), | 15 persist_clients_across_restarts(true), |
16 garbage_collection_interval(base::TimeDelta::FromMinutes(5)), | 16 garbage_collection_interval(base::TimeDelta::FromMinutes(5)), |
17 max_report_age(base::TimeDelta::FromMinutes(15)), | 17 max_report_age(base::TimeDelta::FromMinutes(15)), |
18 max_report_attempts(5) { | 18 max_report_attempts(5), |
| 19 clear_reports_on_network_changes(true), |
| 20 clear_clients_on_network_changes(false) { |
19 endpoint_backoff_policy.num_errors_to_ignore = 0; | 21 endpoint_backoff_policy.num_errors_to_ignore = 0; |
20 endpoint_backoff_policy.initial_delay_ms = 60 * 1000; // 1 minute | 22 endpoint_backoff_policy.initial_delay_ms = 60 * 1000; // 1 minute |
21 endpoint_backoff_policy.multiply_factor = 2.0; | 23 endpoint_backoff_policy.multiply_factor = 2.0; |
22 endpoint_backoff_policy.jitter_factor = 0.1; | 24 endpoint_backoff_policy.jitter_factor = 0.1; |
23 endpoint_backoff_policy.maximum_backoff_ms = -1; // 1 hour | 25 endpoint_backoff_policy.maximum_backoff_ms = -1; // 1 hour |
24 endpoint_backoff_policy.entry_lifetime_ms = -1; // infinite | 26 endpoint_backoff_policy.entry_lifetime_ms = -1; // infinite |
25 endpoint_backoff_policy.always_use_initial_delay = false; | 27 endpoint_backoff_policy.always_use_initial_delay = false; |
26 } | 28 } |
27 | 29 |
28 ReportingPolicy::ReportingPolicy(const ReportingPolicy& other) | 30 ReportingPolicy::ReportingPolicy(const ReportingPolicy& other) |
29 : delivery_interval(base::TimeDelta::FromMinutes(1)), | 31 : delivery_interval(base::TimeDelta::FromMinutes(1)), |
30 endpoint_backoff_policy(other.endpoint_backoff_policy), | 32 endpoint_backoff_policy(other.endpoint_backoff_policy), |
31 persistence_interval(other.persistence_interval), | 33 persistence_interval(other.persistence_interval), |
32 persist_reports_across_restarts(other.persist_reports_across_restarts), | 34 persist_reports_across_restarts(other.persist_reports_across_restarts), |
33 persist_clients_across_restarts(other.persist_clients_across_restarts), | 35 persist_clients_across_restarts(other.persist_clients_across_restarts), |
34 garbage_collection_interval(other.garbage_collection_interval), | 36 garbage_collection_interval(other.garbage_collection_interval), |
35 max_report_age(other.max_report_age), | 37 max_report_age(other.max_report_age), |
36 max_report_attempts(other.max_report_attempts) {} | 38 max_report_attempts(other.max_report_attempts), |
| 39 clear_reports_on_network_changes(other.clear_reports_on_network_changes), |
| 40 clear_clients_on_network_changes(other.clear_clients_on_network_changes) { |
| 41 } |
37 | 42 |
38 ReportingPolicy::~ReportingPolicy() {} | 43 ReportingPolicy::~ReportingPolicy() {} |
39 | 44 |
40 } // namespace net | 45 } // namespace net |
OLD | NEW |