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

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

Issue 8965025: Refactoring of job dispatch in HostResolverImpl in preparation for DnsClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes from try bots. Created 8 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/connection_tester.h" 5 #include "chrome/browser/net/connection_tester.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 private: 103 private:
104 // Creates a host resolver for |experiment|. On success returns net::OK and 104 // Creates a host resolver for |experiment|. On success returns net::OK and
105 // fills |host_resolver| with a new pointer. Otherwise returns a network 105 // fills |host_resolver| with a new pointer. Otherwise returns a network
106 // error code. 106 // error code.
107 int CreateHostResolver( 107 int CreateHostResolver(
108 ConnectionTester::HostResolverExperiment experiment, 108 ConnectionTester::HostResolverExperiment experiment,
109 scoped_ptr<net::HostResolver>* host_resolver) { 109 scoped_ptr<net::HostResolver>* host_resolver) {
110 // Create a vanilla HostResolver that disables caching. 110 // Create a vanilla HostResolver that disables caching.
111 const size_t kMaxJobs = 50u; 111 const size_t kMaxJobs = 50u;
112 const size_t kMaxRetryAttempts = 4u; 112 const size_t kMaxRetryAttempts = 4u;
113 net::PrioritizedDispatcher::Limits limits = { kMaxJobs };
113 net::HostResolverImpl* impl = 114 net::HostResolverImpl* impl =
114 new net::HostResolverImpl(NULL, NULL, kMaxJobs, kMaxRetryAttempts, 115 new net::HostResolverImpl(
115 NULL); 116 NULL /* HostCache */,
117 limits,
118 net::HostResolverImpl::ProcTaskParams(NULL, kMaxRetryAttempts),
119 NULL /* NetLog */);
116 120
117 host_resolver->reset(impl); 121 host_resolver->reset(impl);
118 122
119 // Modify it slightly based on the experiment being run. 123 // Modify it slightly based on the experiment being run.
120 switch (experiment) { 124 switch (experiment) {
121 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: 125 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN:
122 return net::OK; 126 return net::OK;
123 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: 127 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6:
124 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); 128 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
125 return net::OK; 129 return net::OK;
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 465
462 // Notify the delegate of completion. 466 // Notify the delegate of completion.
463 delegate_->OnCompletedConnectionTestExperiment(current, result); 467 delegate_->OnCompletedConnectionTestExperiment(current, result);
464 468
465 if (remaining_experiments_.empty()) { 469 if (remaining_experiments_.empty()) {
466 delegate_->OnCompletedConnectionTestSuite(); 470 delegate_->OnCompletedConnectionTestSuite();
467 } else { 471 } else {
468 StartNextExperiment(); 472 StartNextExperiment();
469 } 473 }
470 } 474 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/passive_log_collector.h » ('j') | net/base/prioritized_dispatcher.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698