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 #include "components/domain_reliability/beacon.h" | 5 #include "components/domain_reliability/beacon.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "components/domain_reliability/util.h" | 10 #include "components/domain_reliability/util.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 | 12 |
13 namespace domain_reliability { | 13 namespace domain_reliability { |
14 | 14 |
15 using base::Value; | 15 using base::Value; |
16 using base::DictionaryValue; | 16 using base::DictionaryValue; |
17 | 17 |
18 DomainReliabilityBeacon::DomainReliabilityBeacon() {} | 18 DomainReliabilityBeacon::DomainReliabilityBeacon() {} |
| 19 DomainReliabilityBeacon::DomainReliabilityBeacon( |
| 20 const DomainReliabilityBeacon& other) = default; |
19 DomainReliabilityBeacon::~DomainReliabilityBeacon() {} | 21 DomainReliabilityBeacon::~DomainReliabilityBeacon() {} |
20 | 22 |
21 scoped_ptr<Value> DomainReliabilityBeacon::ToValue( | 23 scoped_ptr<Value> DomainReliabilityBeacon::ToValue( |
22 base::TimeTicks upload_time, | 24 base::TimeTicks upload_time, |
23 base::TimeTicks last_network_change_time, | 25 base::TimeTicks last_network_change_time, |
24 const GURL& collector_url, | 26 const GURL& collector_url, |
25 const ScopedVector<std::string>& path_prefixes) const { | 27 const ScopedVector<std::string>& path_prefixes) const { |
26 scoped_ptr<DictionaryValue> beacon_value(new DictionaryValue()); | 28 scoped_ptr<DictionaryValue> beacon_value(new DictionaryValue()); |
27 DCHECK(url.is_valid()); | 29 DCHECK(url.is_valid()); |
28 GURL sanitized_url = SanitizeURLForReport(url, collector_url, path_prefixes); | 30 GURL sanitized_url = SanitizeURLForReport(url, collector_url, path_prefixes); |
(...skipping 17 matching lines...) Expand all Loading... |
46 beacon_value->SetInteger("request_elapsed_ms", elapsed.InMilliseconds()); | 48 beacon_value->SetInteger("request_elapsed_ms", elapsed.InMilliseconds()); |
47 base::TimeDelta request_age = upload_time - start_time; | 49 base::TimeDelta request_age = upload_time - start_time; |
48 beacon_value->SetInteger("request_age_ms", request_age.InMilliseconds()); | 50 beacon_value->SetInteger("request_age_ms", request_age.InMilliseconds()); |
49 bool network_changed = last_network_change_time > start_time; | 51 bool network_changed = last_network_change_time > start_time; |
50 beacon_value->SetBoolean("network_changed", network_changed); | 52 beacon_value->SetBoolean("network_changed", network_changed); |
51 beacon_value->SetDouble("sample_rate", sample_rate); | 53 beacon_value->SetDouble("sample_rate", sample_rate); |
52 return std::move(beacon_value); | 54 return std::move(beacon_value); |
53 } | 55 } |
54 | 56 |
55 } // namespace domain_reliability | 57 } // namespace domain_reliability |
OLD | NEW |