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

Side by Side Diff: net/url_request/url_request_context.h

Issue 118100: Avoid doing concurrent DNS resolves of the same hostname (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Get compiling on mac Created 11 years, 6 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // This class represents contextual information (cookies, cache, etc.) 5 // This class represents contextual information (cookies, cache, etc.)
6 // that's useful when processing resource requests. 6 // that's useful when processing resource requests.
7 // The class is reference-counted so that it can be cleaned up after any 7 // The class is reference-counted so that it can be cleaned up after any
8 // requests that are using it have been completed. 8 // requests that are using it have been completed.
9 9
10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 11 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
12 12
13 #include "base/ref_counted.h" 13 #include "base/ref_counted.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "net/base/cookie_policy.h" 15 #include "net/base/cookie_policy.h"
16 #include "net/ftp/ftp_auth_cache.h" 16 #include "net/ftp/ftp_auth_cache.h"
17 17
18 namespace net { 18 namespace net {
19 class CookieMonster; 19 class CookieMonster;
20 class ForceTLSState; 20 class ForceTLSState;
21 class FtpTransactionFactory; 21 class FtpTransactionFactory;
22 class HostResolver;
22 class HttpTransactionFactory; 23 class HttpTransactionFactory;
23 class ProxyService; 24 class ProxyService;
24 } 25 }
25 26
26 // Subclass to provide application-specific context for URLRequest instances. 27 // Subclass to provide application-specific context for URLRequest instances.
27 class URLRequestContext : 28 class URLRequestContext :
28 public base::RefCountedThreadSafe<URLRequestContext> { 29 public base::RefCountedThreadSafe<URLRequestContext> {
29 public: 30 public:
30 URLRequestContext() 31 URLRequestContext()
31 : proxy_service_(NULL), 32 : host_resolver_(NULL),
33 proxy_service_(NULL),
32 http_transaction_factory_(NULL), 34 http_transaction_factory_(NULL),
33 ftp_transaction_factory_(NULL), 35 ftp_transaction_factory_(NULL),
34 cookie_store_(NULL), 36 cookie_store_(NULL),
35 force_tls_state_(NULL) { 37 force_tls_state_(NULL) {
36 } 38 }
37 39
40 net::HostResolver* host_resolver() const {
41 return host_resolver_;
42 }
43
38 // Get the proxy service for this context. 44 // Get the proxy service for this context.
39 net::ProxyService* proxy_service() const { 45 net::ProxyService* proxy_service() const {
40 return proxy_service_; 46 return proxy_service_;
41 } 47 }
42 48
43 // Gets the http transaction factory for this context. 49 // Gets the http transaction factory for this context.
44 net::HttpTransactionFactory* http_transaction_factory() { 50 net::HttpTransactionFactory* http_transaction_factory() {
45 return http_transaction_factory_; 51 return http_transaction_factory_;
46 } 52 }
47 53
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 referrer_charset_ = charset; 87 referrer_charset_ = charset;
82 } 88 }
83 89
84 protected: 90 protected:
85 friend class base::RefCountedThreadSafe<URLRequestContext>; 91 friend class base::RefCountedThreadSafe<URLRequestContext>;
86 92
87 virtual ~URLRequestContext() {} 93 virtual ~URLRequestContext() {}
88 94
89 // The following members are expected to be initialized and owned by 95 // The following members are expected to be initialized and owned by
90 // subclasses. 96 // subclasses.
97 net::HostResolver* host_resolver_;
91 net::ProxyService* proxy_service_; 98 net::ProxyService* proxy_service_;
92 net::HttpTransactionFactory* http_transaction_factory_; 99 net::HttpTransactionFactory* http_transaction_factory_;
93 net::FtpTransactionFactory* ftp_transaction_factory_; 100 net::FtpTransactionFactory* ftp_transaction_factory_;
94 net::CookieMonster* cookie_store_; 101 net::CookieMonster* cookie_store_;
95 net::CookiePolicy cookie_policy_; 102 net::CookiePolicy cookie_policy_;
96 net::ForceTLSState* force_tls_state_;; 103 net::ForceTLSState* force_tls_state_;;
97 net::FtpAuthCache ftp_auth_cache_; 104 net::FtpAuthCache ftp_auth_cache_;
98 std::string accept_language_; 105 std::string accept_language_;
99 std::string accept_charset_; 106 std::string accept_charset_;
100 // The charset of the referrer where this request comes from. It's not 107 // The charset of the referrer where this request comes from. It's not
101 // used in communication with a server but is used to construct a suggested 108 // used in communication with a server but is used to construct a suggested
102 // filename for file download. 109 // filename for file download.
103 std::string referrer_charset_; 110 std::string referrer_charset_;
104 111
105 private: 112 private:
106 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); 113 DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
107 }; 114 };
108 115
109 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ 116 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698