diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/http/http_cache.cc | 6 | ||||
-rw-r--r-- | net/http/http_cache.h | 1 | ||||
-rw-r--r-- | net/http/http_network_layer.h | 3 | ||||
-rw-r--r-- | net/http/http_transaction_factory.h | 5 | ||||
-rw-r--r-- | net/http/http_transaction_unittest.h | 4 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 2 |
6 files changed, 18 insertions, 3 deletions
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc index b6a8bc33..ffc941c 100644 --- a/net/http/http_cache.cc +++ b/net/http/http_cache.cc @@ -1680,6 +1680,12 @@ HttpCache* HttpCache::GetCache() { return this; } +HttpNetworkSession* HttpCache::GetSession() { + net::HttpNetworkLayer* network = + static_cast<net::HttpNetworkLayer*>(network_layer_.get()); + return network->GetSession(); +} + void HttpCache::Suspend(bool suspend) { network_layer_->Suspend(suspend); } diff --git a/net/http/http_cache.h b/net/http/http_cache.h index 15163b07..35d16c6 100644 --- a/net/http/http_cache.h +++ b/net/http/http_cache.h @@ -97,6 +97,7 @@ class HttpCache : public HttpTransactionFactory, // HttpTransactionFactory implementation: virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); virtual HttpCache* GetCache(); + virtual HttpNetworkSession* GetSession(); virtual void Suspend(bool suspend); // Helper function for reading response info from the disk cache. If the diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h index d73c0cd..7defb4e 100644 --- a/net/http/http_network_layer.h +++ b/net/http/http_network_layer.h @@ -47,10 +47,9 @@ class HttpNetworkLayer : public HttpTransactionFactory { // HttpTransactionFactory methods: virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans); virtual HttpCache* GetCache(); + virtual HttpNetworkSession* GetSession(); virtual void Suspend(bool suspend); - HttpNetworkSession* GetSession(); - private: // The factory we will use to create network sockets. ClientSocketFactory* socket_factory_; diff --git a/net/http/http_transaction_factory.h b/net/http/http_transaction_factory.h index 90d36e9..3d37ffe 100644 --- a/net/http/http_transaction_factory.h +++ b/net/http/http_transaction_factory.h @@ -10,8 +10,10 @@ namespace net { class HttpCache; +class HttpNetworkSession; class HttpTransaction; + // An interface to a class that can create HttpTransaction objects. class HttpTransactionFactory { public: @@ -24,6 +26,9 @@ class HttpTransactionFactory { // Returns the associated cache if any (may be NULL). virtual HttpCache* GetCache() = 0; + // Returns the associated HttpNetworkSession used by new transactions. + virtual HttpNetworkSession* GetSession() = 0; + // Suspends the creation of new transactions. If |suspend| is false, creation // of new transactions is resumed. virtual void Suspend(bool suspend) = 0; diff --git a/net/http/http_transaction_unittest.h b/net/http/http_transaction_unittest.h index ab27b27..4de8efd 100644 --- a/net/http/http_transaction_unittest.h +++ b/net/http/http_transaction_unittest.h @@ -322,6 +322,10 @@ class MockNetworkLayer : public net::HttpTransactionFactory { return NULL; } + virtual net::HttpNetworkSession* GetSession() { + return NULL; + } + virtual void Suspend(bool suspend) {} int transaction_count() const { return transaction_count_; } diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index 37cf650..a1cc345 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -52,7 +52,7 @@ class URLRequestContext : } // Gets the http transaction factory for this context. - net::HttpTransactionFactory* http_transaction_factory() { + net::HttpTransactionFactory* http_transaction_factory() const { return http_transaction_factory_; } |