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

Side by Side Diff: chrome/browser/net/dns_probe_service.cc

Issue 1047103002: Avoid initial NetworkChangeNotifier OnDNSChanged() signal on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: revert an accidental test enabling Created 5 years, 8 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 | « chrome/browser/net/dns_probe_service.h ('k') | net/android/network_change_notifier_android.h » ('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 "chrome/browser/net/dns_probe_service.h" 5 #include "chrome/browser/net/dns_probe_service.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/base/ip_endpoint.h" 10 #include "net/base/ip_endpoint.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // Do nothing; probe is already running, and will call the callback. 113 // Do nothing; probe is already running, and will call the callback.
114 break; 114 break;
115 } 115 }
116 } 116 }
117 117
118 void DnsProbeService::OnDNSChanged() { 118 void DnsProbeService::OnDNSChanged() {
119 ClearCachedResult(); 119 ClearCachedResult();
120 SetSystemClientToCurrentConfig(); 120 SetSystemClientToCurrentConfig();
121 } 121 }
122 122
123 void DnsProbeService::OnInitialDNSConfigRead() {
124 OnDNSChanged();
125 }
126
123 void DnsProbeService::SetSystemClientForTesting( 127 void DnsProbeService::SetSystemClientForTesting(
124 scoped_ptr<DnsClient> system_client) { 128 scoped_ptr<DnsClient> system_client) {
125 system_runner_.SetClient(system_client.Pass()); 129 system_runner_.SetClient(system_client.Pass());
126 } 130 }
127 131
128 void DnsProbeService::SetPublicClientForTesting( 132 void DnsProbeService::SetPublicClientForTesting(
129 scoped_ptr<DnsClient> public_client) { 133 scoped_ptr<DnsClient> public_client) {
130 public_runner_.SetClient(public_client.Pass()); 134 public_runner_.SetClient(public_client.Pass());
131 } 135 }
132 136
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 bool DnsProbeService::CachedResultIsExpired() const { 220 bool DnsProbeService::CachedResultIsExpired() const {
217 if (state_ != STATE_RESULT_CACHED) 221 if (state_ != STATE_RESULT_CACHED)
218 return false; 222 return false;
219 223
220 const base::TimeDelta kMaxResultAge = 224 const base::TimeDelta kMaxResultAge =
221 base::TimeDelta::FromMilliseconds(kMaxResultAgeMs); 225 base::TimeDelta::FromMilliseconds(kMaxResultAgeMs);
222 return base::Time::Now() - probe_start_time_ > kMaxResultAge; 226 return base::Time::Now() - probe_start_time_ > kMaxResultAge;
223 } 227 }
224 228
225 } // namespace chrome_browser_net 229 } // namespace chrome_browser_net
OLDNEW
« no previous file with comments | « chrome/browser/net/dns_probe_service.h ('k') | net/android/network_change_notifier_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698