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/monitor.h" | 5 #include "components/domain_reliability/monitor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
davidben
2016/08/30 00:52:54
I think this is no longer needed?
Avi (use Gerrit)
2016/08/30 16:11:26
There's still a base::WrapUnique in the file on li
| |
12 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
13 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
14 #include "base/task_runner.h" | 14 #include "base/task_runner.h" |
15 #include "components/domain_reliability/baked_in_configs.h" | 15 #include "components/domain_reliability/baked_in_configs.h" |
16 #include "components/domain_reliability/google_configs.h" | 16 #include "components/domain_reliability/google_configs.h" |
17 #include "components/domain_reliability/header.h" | 17 #include "components/domain_reliability/header.h" |
18 #include "components/domain_reliability/quic_error_mapping.h" | 18 #include "components/domain_reliability/quic_error_mapping.h" |
19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
20 #include "net/base/load_flags.h" | 20 #include "net/base/load_flags.h" |
21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 std::unique_ptr<const DomainReliabilityConfig> config = | 164 std::unique_ptr<const DomainReliabilityConfig> config = |
165 DomainReliabilityConfig::FromJSON(json); | 165 DomainReliabilityConfig::FromJSON(json); |
166 if (!config) { | 166 if (!config) { |
167 DLOG(WARNING) << "Baked-in Domain Reliability config failed to parse: " | 167 DLOG(WARNING) << "Baked-in Domain Reliability config failed to parse: " |
168 << json; | 168 << json; |
169 continue; | 169 continue; |
170 } | 170 } |
171 context_manager_.AddContextForConfig(std::move(config)); | 171 context_manager_.AddContextForConfig(std::move(config)); |
172 } | 172 } |
173 | 173 |
174 std::vector<DomainReliabilityConfig*> google_configs; | 174 std::vector<std::unique_ptr<DomainReliabilityConfig>> google_configs; |
175 GetAllGoogleConfigs(&google_configs); | 175 GetAllGoogleConfigs(&google_configs); |
176 for (auto* google_config : google_configs) | 176 for (auto& google_config : google_configs) |
177 context_manager_.AddContextForConfig(base::WrapUnique(google_config)); | 177 context_manager_.AddContextForConfig(std::move(google_config)); |
178 } | 178 } |
179 | 179 |
180 void DomainReliabilityMonitor::SetDiscardUploads(bool discard_uploads) { | 180 void DomainReliabilityMonitor::SetDiscardUploads(bool discard_uploads) { |
181 DCHECK(OnNetworkThread()); | 181 DCHECK(OnNetworkThread()); |
182 DCHECK(moved_to_network_thread_); | 182 DCHECK(moved_to_network_thread_); |
183 DCHECK(uploader_); | 183 DCHECK(uploader_); |
184 | 184 |
185 uploader_->set_discard_uploads(discard_uploads); | 185 uploader_->set_discard_uploads(discard_uploads); |
186 discard_uploads_set_ = true; | 186 discard_uploads_set_ = true; |
187 } | 187 } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 return context_manager_.AddContextForConfig(std::move(config)); | 249 return context_manager_.AddContextForConfig(std::move(config)); |
250 } | 250 } |
251 | 251 |
252 std::unique_ptr<DomainReliabilityContext> | 252 std::unique_ptr<DomainReliabilityContext> |
253 DomainReliabilityMonitor::CreateContextForConfig( | 253 DomainReliabilityMonitor::CreateContextForConfig( |
254 std::unique_ptr<const DomainReliabilityConfig> config) { | 254 std::unique_ptr<const DomainReliabilityConfig> config) { |
255 DCHECK(OnNetworkThread()); | 255 DCHECK(OnNetworkThread()); |
256 DCHECK(config); | 256 DCHECK(config); |
257 DCHECK(config->IsValid()); | 257 DCHECK(config->IsValid()); |
258 | 258 |
259 return base::WrapUnique(new DomainReliabilityContext( | 259 return base::WrapUnique(new DomainReliabilityContext( |
Avi (use Gerrit)
2016/08/30 16:11:25
...here.
| |
260 time_.get(), scheduler_params_, upload_reporter_string_, | 260 time_.get(), scheduler_params_, upload_reporter_string_, |
261 &last_network_change_time_, &dispatcher_, uploader_.get(), | 261 &last_network_change_time_, &dispatcher_, uploader_.get(), |
262 std::move(config))); | 262 std::move(config))); |
263 } | 263 } |
264 | 264 |
265 DomainReliabilityMonitor::RequestInfo::RequestInfo() {} | 265 DomainReliabilityMonitor::RequestInfo::RequestInfo() {} |
266 | 266 |
267 DomainReliabilityMonitor::RequestInfo::RequestInfo( | 267 DomainReliabilityMonitor::RequestInfo::RequestInfo( |
268 const net::URLRequest& request) | 268 const net::URLRequest& request) |
269 : url(request.url()), | 269 : url(request.url()), |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
415 break; | 415 break; |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 base::WeakPtr<DomainReliabilityMonitor> | 419 base::WeakPtr<DomainReliabilityMonitor> |
420 DomainReliabilityMonitor::MakeWeakPtr() { | 420 DomainReliabilityMonitor::MakeWeakPtr() { |
421 return weak_factory_.GetWeakPtr(); | 421 return weak_factory_.GetWeakPtr(); |
422 } | 422 } |
423 | 423 |
424 } // namespace domain_reliability | 424 } // namespace domain_reliability |
OLD | NEW |