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

Side by Side Diff: net/base/host_resolver_impl.cc

Issue 10828373: [net] Add AsyncDns field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better var names Created 8 years, 4 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
« chrome/browser/io_thread.cc ('K') | « net/base/host_resolver.h ('k') | no next file » | 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/base/host_resolver_impl.h" 5 #include "net/base/host_resolver_impl.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <Winsock2.h> 8 #include <Winsock2.h>
9 #elif defined(OS_POSIX) 9 #elif defined(OS_POSIX)
10 #include <netdb.h> 10 #include <netdb.h>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 size_t max_retry_attempts, 460 size_t max_retry_attempts,
461 NetLog* net_log) { 461 NetLog* net_log) {
462 return CreateHostResolver(max_concurrent_resolves, 462 return CreateHostResolver(max_concurrent_resolves,
463 max_retry_attempts, 463 max_retry_attempts,
464 HostCache::CreateDefaultCache(), 464 HostCache::CreateDefaultCache(),
465 DnsConfigService::CreateSystemService(), 465 DnsConfigService::CreateSystemService(),
466 DnsClient::CreateClient(net_log), 466 DnsClient::CreateClient(net_log),
467 net_log); 467 net_log);
468 } 468 }
469 469
470 bool ConfigureAsyncDnsFieldTrial() {
471 const base::FieldTrial::Probability kAsyncDnsDivisor = 100;
cbentzel 2012/08/20 11:45:56 Perhaps restrict enabled_probability to non-0 valu
szym 2012/08/20 17:54:21 Good idea although net cannot depend on chrome/ an
cbentzel 2012/08/21 10:50:53 Yes. I personally think it makes sense there - you
472 base::FieldTrial::Probability enabled_probability = 50;
473
474 scoped_refptr<base::FieldTrial> trial(
475 base::FieldTrialList::FactoryGetFieldTrial(
476 "AsyncDns", kAsyncDnsDivisor, "disabled", 2012, 9, 30, NULL));
477
478 int enabled_group = trial->AppendGroup("enabled", enabled_probability);
cbentzel 2012/08/21 10:50:53 Should this be restricted to supported platforms o
479 return trial->group() == enabled_group;
480 }
481
470 //----------------------------------------------------------------------------- 482 //-----------------------------------------------------------------------------
471 483
472 // Holds the data for a request that could not be completed synchronously. 484 // Holds the data for a request that could not be completed synchronously.
473 // It is owned by a Job. Canceled Requests are only marked as canceled rather 485 // It is owned by a Job. Canceled Requests are only marked as canceled rather
474 // than removed from the Job's |requests_| list. 486 // than removed from the Job's |requests_| list.
475 class HostResolverImpl::Request { 487 class HostResolverImpl::Request {
476 public: 488 public:
477 Request(const BoundNetLog& source_net_log, 489 Request(const BoundNetLog& source_net_log,
478 const BoundNetLog& request_net_log, 490 const BoundNetLog& request_net_log,
479 const RequestInfo& info, 491 const RequestInfo& info,
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 // |this| may be deleted inside AbortAllInProgressJobs(). 2158 // |this| may be deleted inside AbortAllInProgressJobs().
2147 if (self) 2159 if (self)
2148 TryServingAllJobsFromHosts(); 2160 TryServingAllJobsFromHosts();
2149 } 2161 }
2150 2162
2151 bool HostResolverImpl::HaveDnsConfig() const { 2163 bool HostResolverImpl::HaveDnsConfig() const {
2152 return (dns_client_.get() != NULL) && (dns_client_->GetConfig() != NULL); 2164 return (dns_client_.get() != NULL) && (dns_client_->GetConfig() != NULL);
2153 } 2165 }
2154 2166
2155 } // namespace net 2167 } // namespace net
OLDNEW
« chrome/browser/io_thread.cc ('K') | « net/base/host_resolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698