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

Side by Side Diff: net/proxy/dhcp_proxy_script_fetcher_win.cc

Issue 10692155: Switch to TimeDelta interfaces for process waiting functions in net and ipc. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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
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/proxy/dhcp_proxy_script_fetcher_win.h" 5 #include "net/proxy/dhcp_proxy_script_fetcher_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/perftimer.h" 10 #include "base/perftimer.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 if (!did_finish || result != ERR_PAC_NOT_IN_DHCP) { 187 if (!did_finish || result != ERR_PAC_NOT_IN_DHCP) {
188 break; 188 break;
189 } 189 }
190 } 190 }
191 191
192 // Once we have a single result, we set a maximum on how long to wait 192 // Once we have a single result, we set a maximum on how long to wait
193 // for the rest of the results. 193 // for the rest of the results.
194 if (state_ == STATE_NO_RESULTS) { 194 if (state_ == STATE_NO_RESULTS) {
195 state_ = STATE_SOME_RESULTS; 195 state_ = STATE_SOME_RESULTS;
196 wait_timer_.Start(FROM_HERE, 196 wait_timer_.Start(FROM_HERE,
197 base::TimeDelta::FromMilliseconds(ImplGetMaxWaitMs()), 197 ImplGetMaxWait(), this, &DhcpProxyScriptFetcherWin::OnWaitTimer);
198 this, &DhcpProxyScriptFetcherWin::OnWaitTimer);
199 } 198 }
200 } 199 }
201 200
202 void DhcpProxyScriptFetcherWin::OnWaitTimer() { 201 void DhcpProxyScriptFetcherWin::OnWaitTimer() {
203 DCHECK_EQ(state_, STATE_SOME_RESULTS); 202 DCHECK_EQ(state_, STATE_SOME_RESULTS);
204 203
205 // These are intended to help us understand whether our timeout may 204 // These are intended to help us understand whether our timeout may
206 // be too aggressive or not aggressive enough. 205 // be too aggressive or not aggressive enough.
207 UMA_HISTOGRAM_COUNTS_100("Net.DhcpWpadNumAdaptersAtWaitTimer", 206 UMA_HISTOGRAM_COUNTS_100("Net.DhcpWpadNumAdaptersAtWaitTimer",
208 fetchers_.size()); 207 fetchers_.size());
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 DhcpProxyScriptAdapterFetcher* 275 DhcpProxyScriptAdapterFetcher*
277 DhcpProxyScriptFetcherWin::ImplCreateAdapterFetcher() { 276 DhcpProxyScriptFetcherWin::ImplCreateAdapterFetcher() {
278 return new DhcpProxyScriptAdapterFetcher(url_request_context_); 277 return new DhcpProxyScriptAdapterFetcher(url_request_context_);
279 } 278 }
280 279
281 DhcpProxyScriptFetcherWin::AdapterQuery* 280 DhcpProxyScriptFetcherWin::AdapterQuery*
282 DhcpProxyScriptFetcherWin::ImplCreateAdapterQuery() { 281 DhcpProxyScriptFetcherWin::ImplCreateAdapterQuery() {
283 return new AdapterQuery(); 282 return new AdapterQuery();
284 } 283 }
285 284
286 int DhcpProxyScriptFetcherWin::ImplGetMaxWaitMs() { 285 base::TimeDelta DhcpProxyScriptFetcherWin::ImplGetMaxWait() {
287 return kMaxWaitAfterFirstResultMs; 286 return base::TimeDelta::FromMilliseconds(kMaxWaitAfterFirstResultMs);
288 } 287 }
289 288
290 bool DhcpProxyScriptFetcherWin::GetCandidateAdapterNames( 289 bool DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(
291 std::set<std::string>* adapter_names) { 290 std::set<std::string>* adapter_names) {
292 DCHECK(adapter_names); 291 DCHECK(adapter_names);
293 adapter_names->clear(); 292 adapter_names->clear();
294 293
295 // The GetAdaptersAddresses MSDN page recommends using a size of 15000 to 294 // The GetAdaptersAddresses MSDN page recommends using a size of 15000 to
296 // avoid reallocation. 295 // avoid reallocation.
297 ULONG adapters_size = 15000; 296 ULONG adapters_size = 15000;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 DhcpProxyScriptFetcherWin::AdapterQuery::adapter_names() const { 366 DhcpProxyScriptFetcherWin::AdapterQuery::adapter_names() const {
368 return adapter_names_; 367 return adapter_names_;
369 } 368 }
370 369
371 bool DhcpProxyScriptFetcherWin::AdapterQuery::ImplGetCandidateAdapterNames( 370 bool DhcpProxyScriptFetcherWin::AdapterQuery::ImplGetCandidateAdapterNames(
372 std::set<std::string>* adapter_names) { 371 std::set<std::string>* adapter_names) {
373 return DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(adapter_names); 372 return DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(adapter_names);
374 } 373 }
375 374
376 } // namespace net 375 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher_win.h ('k') | net/proxy/dhcp_proxy_script_fetcher_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698