| OLD | NEW |
| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::HostResolverImpl* impl = | 113 net::HostResolverImpl* impl = |
| 114 new net::HostResolverImpl(NULL, NULL, kMaxJobs, kMaxRetryAttempts, | 114 new net::HostResolverImpl( |
| 115 NULL); | 115 NULL /* HostCache */, |
| 116 net::PriorityDispatch::Limits::MakeAny(kMaxJobs), |
| 117 net::HostResolverImpl::ProcJobParams(NULL, kMaxRetryAttempts), |
| 118 NULL /* NetLog */); |
| 116 | 119 |
| 117 host_resolver->reset(impl); | 120 host_resolver->reset(impl); |
| 118 | 121 |
| 119 // Modify it slightly based on the experiment being run. | 122 // Modify it slightly based on the experiment being run. |
| 120 switch (experiment) { | 123 switch (experiment) { |
| 121 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: | 124 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_PLAIN: |
| 122 return net::OK; | 125 return net::OK; |
| 123 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: | 126 case ConnectionTester::HOST_RESOLVER_EXPERIMENT_DISABLE_IPV6: |
| 124 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 127 impl->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
| 125 return net::OK; | 128 return net::OK; |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 464 |
| 462 // Notify the delegate of completion. | 465 // Notify the delegate of completion. |
| 463 delegate_->OnCompletedConnectionTestExperiment(current, result); | 466 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 464 | 467 |
| 465 if (remaining_experiments_.empty()) { | 468 if (remaining_experiments_.empty()) { |
| 466 delegate_->OnCompletedConnectionTestSuite(); | 469 delegate_->OnCompletedConnectionTestSuite(); |
| 467 } else { | 470 } else { |
| 468 StartNextExperiment(); | 471 StartNextExperiment(); |
| 469 } | 472 } |
| 470 } | 473 } |
| OLD | NEW |