Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Side by Side Diff: net/dns/dns_session.cc

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/dns/dns_session.h" 5 #include "net/dns/dns_session.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 initial_timeout_ = GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault( 127 initial_timeout_ = GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault(
128 "AsyncDnsInitialTimeoutMsByConnectionType", config_.timeout, type); 128 "AsyncDnsInitialTimeoutMsByConnectionType", config_.timeout, type);
129 max_timeout_ = GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault( 129 max_timeout_ = GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault(
130 "AsyncDnsMaxTimeoutMsByConnectionType", 130 "AsyncDnsMaxTimeoutMsByConnectionType",
131 base::TimeDelta::FromMilliseconds(kDefaultMaxTimeoutMs), type); 131 base::TimeDelta::FromMilliseconds(kDefaultMaxTimeoutMs), type);
132 } 132 }
133 133
134 void DnsSession::InitializeServerStats() { 134 void DnsSession::InitializeServerStats() {
135 server_stats_.clear(); 135 server_stats_.clear();
136 for (size_t i = 0; i < config_.nameservers.size(); ++i) { 136 for (size_t i = 0; i < config_.nameservers.size(); ++i) {
137 server_stats_.push_back(base::WrapUnique( 137 server_stats_.push_back(base::MakeUnique<ServerStats>(
138 new ServerStats(initial_timeout_, rtt_buckets_.Pointer()))); 138 initial_timeout_, rtt_buckets_.Pointer()));
139 } 139 }
140 } 140 }
141 141
142 void DnsSession::OnConnectionTypeChanged( 142 void DnsSession::OnConnectionTypeChanged(
143 NetworkChangeNotifier::ConnectionType type) { 143 NetworkChangeNotifier::ConnectionType type) {
144 UpdateTimeouts(type); 144 UpdateTimeouts(type);
145 const char* kTrialName = "AsyncDnsFlushServerStatsOnConnectionTypeChange"; 145 const char* kTrialName = "AsyncDnsFlushServerStatsOnConnectionTypeChange";
146 if (base::FieldTrialList::FindFullName(kTrialName) == "enable") { 146 if (base::FieldTrialList::FindFullName(kTrialName) == "enable") {
147 RecordServerStats(); 147 RecordServerStats();
148 InitializeServerStats(); 148 InitializeServerStats();
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 timeout = std::max(timeout, base::TimeDelta::FromMilliseconds(kMinTimeoutMs)); 347 timeout = std::max(timeout, base::TimeDelta::FromMilliseconds(kMinTimeoutMs));
348 348
349 // The timeout still doubles every full round. 349 // The timeout still doubles every full round.
350 unsigned num_backoffs = attempt / config_.nameservers.size(); 350 unsigned num_backoffs = attempt / config_.nameservers.size();
351 351
352 return std::min(timeout * (1 << num_backoffs), max_timeout_); 352 return std::min(timeout * (1 << num_backoffs), max_timeout_);
353 } 353 }
354 354
355 } // namespace net 355 } // namespace net
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_backend_impl.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698