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

Side by Side Diff: net/dns/dns_client.cc

Issue 10855163: Revert 151586 - [net/dns] Resolve AF_UNSPEC on dual-stacked systems. Sort addresses according to RF… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « net/dns/dns_client.h ('k') | net/dns/dns_response.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
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/dns/dns_client.h" 5 #include "net/dns/dns_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/rand_util.h" 8 #include "base/rand_util.h"
9 #include "net/base/net_log.h" 9 #include "net/base/net_log.h"
10 #include "net/dns/address_sorter.h"
11 #include "net/dns/dns_config_service.h" 10 #include "net/dns/dns_config_service.h"
12 #include "net/dns/dns_session.h" 11 #include "net/dns/dns_session.h"
13 #include "net/dns/dns_transaction.h" 12 #include "net/dns/dns_transaction.h"
14 #include "net/socket/client_socket_factory.h" 13 #include "net/socket/client_socket_factory.h"
15 14
16 namespace net { 15 namespace net {
17 16
18 namespace { 17 namespace {
19 18
20 class DnsClientImpl : public DnsClient { 19 class DnsClientImpl : public DnsClient {
21 public: 20 public:
22 explicit DnsClientImpl(NetLog* net_log) 21 explicit DnsClientImpl(NetLog* net_log) : net_log_(net_log) {}
23 : address_sorter_(AddressSorter::CreateAddressSorter()),
24 net_log_(net_log) {}
25 22
26 virtual void SetConfig(const DnsConfig& config) OVERRIDE { 23 virtual void SetConfig(const DnsConfig& config) OVERRIDE {
27 factory_.reset(); 24 factory_.reset();
28 session_.release(); 25 session_.release();
29 if (config.IsValid()) { 26 if (config.IsValid()) {
30 session_ = new DnsSession(config, 27 session_ = new DnsSession(config,
31 ClientSocketFactory::GetDefaultFactory(), 28 ClientSocketFactory::GetDefaultFactory(),
32 base::Bind(&base::RandInt), 29 base::Bind(&base::RandInt),
33 net_log_); 30 net_log_);
34 factory_ = DnsTransactionFactory::CreateFactory(session_); 31 factory_ = DnsTransactionFactory::CreateFactory(session_);
35 } 32 }
36 } 33 }
37 34
38 virtual const DnsConfig* GetConfig() const OVERRIDE { 35 virtual const DnsConfig* GetConfig() const OVERRIDE {
39 return session_.get() ? &session_->config() : NULL; 36 return session_.get() ? &session_->config() : NULL;
40 } 37 }
41 38
42 virtual DnsTransactionFactory* GetTransactionFactory() OVERRIDE { 39 virtual DnsTransactionFactory* GetTransactionFactory() OVERRIDE {
43 return session_.get() ? factory_.get() : NULL; 40 return session_.get() ? factory_.get() : NULL;
44 } 41 }
45 42
46 virtual AddressSorter* GetAddressSorter() OVERRIDE {
47 return address_sorter_.get();
48 }
49
50 private: 43 private:
51 scoped_refptr<DnsSession> session_; 44 scoped_refptr<DnsSession> session_;
52 scoped_ptr<DnsTransactionFactory> factory_; 45 scoped_ptr<DnsTransactionFactory> factory_;
53 scoped_ptr<AddressSorter> address_sorter_;
54 46
55 NetLog* net_log_; 47 NetLog* net_log_;
56 }; 48 };
57 49
58 } // namespace 50 } // namespace
59 51
60 // static 52 // static
61 scoped_ptr<DnsClient> DnsClient::CreateClient(NetLog* net_log) { 53 scoped_ptr<DnsClient> DnsClient::CreateClient(NetLog* net_log) {
62 return scoped_ptr<DnsClient>(new DnsClientImpl(net_log)); 54 return scoped_ptr<DnsClient>(new DnsClientImpl(net_log));
63 } 55 }
64 56
65 } // namespace net 57 } // namespace net
66 58
OLDNEW
« no previous file with comments | « net/dns/dns_client.h ('k') | net/dns/dns_response.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698