| Index: net/http/http_network_layer.cc
|
| diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
|
| index 23f53f7764be2175be528aa5966c7c483cc91974..84c22d3cc9da0884a1274429a964a9bba6a9b947 100644
|
| --- a/net/http/http_network_layer.cc
|
| +++ b/net/http/http_network_layer.cc
|
| @@ -21,13 +21,26 @@ HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
|
| return new HttpNetworkLayer(proxy_service);
|
| }
|
|
|
| +// static
|
| +HttpTransactionFactory* HttpNetworkLayer::CreateFactory(
|
| + HttpNetworkSession* session) {
|
| + DCHECK(session);
|
| +
|
| + return new HttpNetworkLayer(session);
|
| +}
|
| +
|
| //-----------------------------------------------------------------------------
|
|
|
| HttpNetworkLayer::HttpNetworkLayer(ProxyService* proxy_service)
|
| - : proxy_service_(proxy_service), suspended_(false) {
|
| + : proxy_service_(proxy_service), session_(NULL), suspended_(false) {
|
| DCHECK(proxy_service_);
|
| }
|
|
|
| +HttpNetworkLayer::HttpNetworkLayer(HttpNetworkSession* session)
|
| + : proxy_service_(NULL), session_(session), suspended_(false) {
|
| + DCHECK(session_.get());
|
| +}
|
| +
|
| HttpNetworkLayer::~HttpNetworkLayer() {
|
| }
|
|
|
| @@ -35,11 +48,8 @@ HttpTransaction* HttpNetworkLayer::CreateTransaction() {
|
| if (suspended_)
|
| return NULL;
|
|
|
| - if (!session_)
|
| - session_ = new HttpNetworkSession(proxy_service_);
|
| -
|
| return new HttpNetworkTransaction(
|
| - session_, ClientSocketFactory::GetDefaultFactory());
|
| + GetSession(), ClientSocketFactory::GetDefaultFactory());
|
| }
|
|
|
| HttpCache* HttpNetworkLayer::GetCache() {
|
| @@ -53,5 +63,13 @@ void HttpNetworkLayer::Suspend(bool suspend) {
|
| session_->connection_pool()->CloseIdleSockets();
|
| }
|
|
|
| +HttpNetworkSession* HttpNetworkLayer::GetSession() {
|
| + if (session_) {
|
| + DCHECK(proxy_service_);
|
| + session_ = new HttpNetworkSession(proxy_service_);
|
| + }
|
| + return session_;
|
| +}
|
| +
|
| } // namespace net
|
|
|
|
|