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