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

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

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed two comments, fix some tests Created 5 years, 3 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
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 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ 5 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_
6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ 6 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 class CertVerifier; 15 class CertVerifier;
16 class ChannelIDService; 16 class ChannelIDService;
17 class CookieStore; 17 class CookieStore;
18 class FtpTransactionFactory; 18 class FtpTransactionFactory;
19 class HostResolver; 19 class HostResolver;
20 class HttpAuthHandlerFactory; 20 class HttpAuthHandlerFactory;
21 class HttpNetworkSession;
21 class HttpServerProperties; 22 class HttpServerProperties;
22 class HttpTransactionFactory; 23 class HttpTransactionFactory;
23 class HttpUserAgentSettings; 24 class HttpUserAgentSettings;
24 class NetLog; 25 class NetLog;
25 class NetworkDelegate; 26 class NetworkDelegate;
26 class ProxyService; 27 class ProxyService;
27 class SdchManager; 28 class SdchManager;
28 class SSLConfigService; 29 class SSLConfigService;
29 class TransportSecurityState; 30 class TransportSecurityState;
30 class URLRequestContext; 31 class URLRequestContext;
(...skipping 21 matching lines...) Expand all
52 void set_http_auth_handler_factory( 53 void set_http_auth_handler_factory(
53 HttpAuthHandlerFactory* http_auth_handler_factory); 54 HttpAuthHandlerFactory* http_auth_handler_factory);
54 void set_proxy_service(ProxyService* proxy_service); 55 void set_proxy_service(ProxyService* proxy_service);
55 void set_ssl_config_service(SSLConfigService* ssl_config_service); 56 void set_ssl_config_service(SSLConfigService* ssl_config_service);
56 void set_network_delegate(NetworkDelegate* network_delegate); 57 void set_network_delegate(NetworkDelegate* network_delegate);
57 void set_http_server_properties( 58 void set_http_server_properties(
58 scoped_ptr<HttpServerProperties> http_server_properties); 59 scoped_ptr<HttpServerProperties> http_server_properties);
59 void set_cookie_store(CookieStore* cookie_store); 60 void set_cookie_store(CookieStore* cookie_store);
60 void set_transport_security_state( 61 void set_transport_security_state(
61 TransportSecurityState* transport_security_state); 62 TransportSecurityState* transport_security_state);
63 void set_http_network_session(
64 scoped_ptr<HttpNetworkSession> http_network_session);
62 void set_http_transaction_factory( 65 void set_http_transaction_factory(
63 HttpTransactionFactory* http_transaction_factory); 66 HttpTransactionFactory* http_transaction_factory);
64 void set_job_factory(URLRequestJobFactory* job_factory); 67 void set_job_factory(URLRequestJobFactory* job_factory);
65 void set_throttler_manager(URLRequestThrottlerManager* throttler_manager); 68 void set_throttler_manager(URLRequestThrottlerManager* throttler_manager);
66 void set_backoff_manager(URLRequestBackoffManager* backoff_manager); 69 void set_backoff_manager(URLRequestBackoffManager* backoff_manager);
67 void set_http_user_agent_settings( 70 void set_http_user_agent_settings(
68 HttpUserAgentSettings* http_user_agent_settings); 71 HttpUserAgentSettings* http_user_agent_settings);
69 void set_sdch_manager(scoped_ptr<SdchManager> sdch_manager); 72 void set_sdch_manager(scoped_ptr<SdchManager> sdch_manager);
70 73
74 // Everything else can be access through the URLRequestContext, but this
75 // cannot. Having an accessor for it makes usage a little cleaner.
76 HttpNetworkSession* http_network_session() const {
77 return http_network_session_.get();
78 }
79
71 private: 80 private:
72 // We use a raw pointer to prevent reference cycles, since 81 // We use a raw pointer to prevent reference cycles, since
73 // URLRequestContextStorage can often be contained within a URLRequestContext 82 // URLRequestContextStorage can often be contained within a URLRequestContext
74 // subclass. 83 // subclass.
75 URLRequestContext* const context_; 84 URLRequestContext* const context_;
76 85
77 // Owned members. 86 // Owned members.
78 scoped_ptr<NetLog> net_log_; 87 scoped_ptr<NetLog> net_log_;
79 scoped_ptr<HostResolver> host_resolver_; 88 scoped_ptr<HostResolver> host_resolver_;
80 scoped_ptr<CertVerifier> cert_verifier_; 89 scoped_ptr<CertVerifier> cert_verifier_;
81 // The ChannelIDService must outlive the HttpTransactionFactory. 90 // The ChannelIDService must outlive the HttpTransactionFactory.
82 scoped_ptr<ChannelIDService> channel_id_service_; 91 scoped_ptr<ChannelIDService> channel_id_service_;
83 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; 92 scoped_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
84 scoped_ptr<ProxyService> proxy_service_; 93 scoped_ptr<ProxyService> proxy_service_;
85 // TODO(willchan): Remove refcounting on these members. 94 // TODO(willchan): Remove refcounting on these members.
86 scoped_refptr<SSLConfigService> ssl_config_service_; 95 scoped_refptr<SSLConfigService> ssl_config_service_;
87 scoped_ptr<NetworkDelegate> network_delegate_; 96 scoped_ptr<NetworkDelegate> network_delegate_;
88 scoped_ptr<HttpServerProperties> http_server_properties_; 97 scoped_ptr<HttpServerProperties> http_server_properties_;
89 scoped_ptr<HttpUserAgentSettings> http_user_agent_settings_; 98 scoped_ptr<HttpUserAgentSettings> http_user_agent_settings_;
90 scoped_refptr<CookieStore> cookie_store_; 99 scoped_refptr<CookieStore> cookie_store_;
91 scoped_ptr<TransportSecurityState> transport_security_state_; 100 scoped_ptr<TransportSecurityState> transport_security_state_;
92 101
102 // Not actually pointed at by the URLRequestContext, but may be used (but not
103 // owned) by the HttpTransactionFactory.
104 scoped_ptr<HttpNetworkSession> http_network_session_;
105
93 scoped_ptr<HttpTransactionFactory> http_transaction_factory_; 106 scoped_ptr<HttpTransactionFactory> http_transaction_factory_;
94 scoped_ptr<URLRequestJobFactory> job_factory_; 107 scoped_ptr<URLRequestJobFactory> job_factory_;
95 scoped_ptr<URLRequestThrottlerManager> throttler_manager_; 108 scoped_ptr<URLRequestThrottlerManager> throttler_manager_;
96 scoped_ptr<URLRequestBackoffManager> backoff_manager_; 109 scoped_ptr<URLRequestBackoffManager> backoff_manager_;
97 scoped_ptr<SdchManager> sdch_manager_; 110 scoped_ptr<SdchManager> sdch_manager_;
98 111
99 DISALLOW_COPY_AND_ASSIGN(URLRequestContextStorage); 112 DISALLOW_COPY_AND_ASSIGN(URLRequestContextStorage);
100 }; 113 };
101 114
102 } // namespace net 115 } // namespace net
103 116
104 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_ 117 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698