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

Side by Side Diff: net/http/http_network_layer.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 #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_ 5 #ifndef NET_HTTP_HTTP_NETWORK_LAYER_H_
6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_ 6 #define NET_HTTP_HTTP_NETWORK_LAYER_H_
7 7
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "net/http/http_transaction_factory.h" 10 #include "net/http/http_transaction_factory.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 class HostResolver;
14 class HttpNetworkSession; 15 class HttpNetworkSession;
15 class ProxyInfo; 16 class ProxyInfo;
16 class ProxyService; 17 class ProxyService;
17 18
18 class HttpNetworkLayer : public HttpTransactionFactory { 19 class HttpNetworkLayer : public HttpTransactionFactory {
19 public: 20 public:
20 // |proxy_service| must remain valid for the lifetime of HttpNetworkLayer. 21 // |proxy_service| and |host_resolver| must remain valid for the lifetime of
21 explicit HttpNetworkLayer(ProxyService* proxy_service); 22 // HttpNetworkLayer.
23 HttpNetworkLayer(HostResolver* host_resolver, ProxyService* proxy_service);
22 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which 24 // Construct a HttpNetworkLayer with an existing HttpNetworkSession which
23 // contains a valid ProxyService. 25 // contains a valid ProxyService.
24 explicit HttpNetworkLayer(HttpNetworkSession* session); 26 explicit HttpNetworkLayer(HttpNetworkSession* session);
25 ~HttpNetworkLayer(); 27 ~HttpNetworkLayer();
26 28
27 // This function hides the details of how a network layer gets instantiated 29 // This function hides the details of how a network layer gets instantiated
28 // and allows other implementations to be substituted. 30 // and allows other implementations to be substituted.
29 static HttpTransactionFactory* CreateFactory(ProxyService* proxy_service); 31 static HttpTransactionFactory* CreateFactory(HostResolver* host_resolver,
32 ProxyService* proxy_service);
30 // Create a transaction factory that instantiate a network layer over an 33 // Create a transaction factory that instantiate a network layer over an
31 // existing network session. Network session contains some valuable 34 // existing network session. Network session contains some valuable
32 // information (e.g. authentication data) that we want to share across 35 // information (e.g. authentication data) that we want to share across
33 // multiple network layers. This method exposes the implementation details 36 // multiple network layers. This method exposes the implementation details
34 // of a network layer, use this method with an existing network layer only 37 // of a network layer, use this method with an existing network layer only
35 // when network session is shared. 38 // when network session is shared.
36 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session); 39 static HttpTransactionFactory* CreateFactory(HttpNetworkSession* session);
37 40
38 // HttpTransactionFactory methods: 41 // HttpTransactionFactory methods:
39 virtual HttpTransaction* CreateTransaction(); 42 virtual HttpTransaction* CreateTransaction();
40 virtual HttpCache* GetCache(); 43 virtual HttpCache* GetCache();
41 virtual void Suspend(bool suspend); 44 virtual void Suspend(bool suspend);
42 45
43 HttpNetworkSession* GetSession(); 46 HttpNetworkSession* GetSession();
44 47
45 private: 48 private:
49 // The host resolver being used for the session.
50 HostResolver* host_resolver_;
51
46 // The proxy service being used for the session. 52 // The proxy service being used for the session.
47 ProxyService* proxy_service_; 53 ProxyService* proxy_service_;
48 54
49 scoped_refptr<HttpNetworkSession> session_; 55 scoped_refptr<HttpNetworkSession> session_;
50 bool suspended_; 56 bool suspended_;
51 }; 57 };
52 58
53 } // namespace net 59 } // namespace net
54 60
55 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_ 61 #endif // NET_HTTP_HTTP_NETWORK_LAYER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698