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

Unified Diff: net/http/http_cache.h

Issue 983007: Http cache: Add support for a dedicated cache thread. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/disk_cache/disk_cache.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.h
===================================================================
--- net/http/http_cache.h (revision 45869)
+++ net/http/http_cache.h (working copy)
@@ -28,6 +28,7 @@
#include "net/http/http_transaction_factory.h"
class GURL;
+class MessageLoop;
class ViewCacheHelper;
namespace disk_cache {
@@ -69,12 +70,14 @@
// Initialize the cache from the directory where its data is stored. The
// disk cache is initialized lazily (by CreateTransaction) in this case. If
// |cache_size| is zero, a default value will be calculated automatically.
+ // The |cache_thread| is the thread where disk operations should take place.
HttpCache(NetworkChangeNotifier* network_change_notifier,
HostResolver* host_resolver,
ProxyService* proxy_service,
SSLConfigService* ssl_config_service,
HttpAuthHandlerFactory* http_auth_handler_factory,
const FilePath& cache_dir,
+ MessageLoop* cache_thread,
int cache_size);
// Initialize the cache from the directory where its data is stored. The
@@ -83,8 +86,9 @@
// Provide an existing HttpNetworkSession, the cache can construct a
// network layer with a shared HttpNetworkSession in order for multiple
// network layers to share information (e.g. authenication data).
+ // The |cache_thread| is the thread where disk operations should take place.
HttpCache(HttpNetworkSession* session, const FilePath& cache_dir,
- int cache_size);
+ MessageLoop* cache_thread, int cache_size);
// Initialize using an in-memory cache. The cache is initialized lazily
// (by CreateTransaction) in this case. If |cache_size| is zero, a default
@@ -108,8 +112,16 @@
// Returns the cache backend for this HttpCache instance. If the backend
// is not initialized yet, this method will initialize it. If the return
// value is NULL then the backend cannot be initialized.
+ // This method is deprecated.
disk_cache::Backend* GetBackend();
+ // Retrieves the cache backend for this HttpCache instance. If the backend
+ // is not initialized yet, this method will initialize it. The return value is
+ // a network error code, and it could be ERR_IO_PENDING, in which case the
+ // |callback| will be notified when the operation completes. The pointer that
+ // receives the |backend| must remain valid until the operation completes.
+ int GetBackend(disk_cache::Backend** backend, CompletionCallback* callback);
+
// HttpTransactionFactory implementation:
virtual int CreateTransaction(scoped_ptr<HttpTransaction>* trans);
virtual HttpCache* GetCache();
@@ -201,7 +213,6 @@
typedef base::hash_map<std::string, NewEntry*> NewEntriesMap;
typedef std::set<ActiveEntry*> ActiveEntriesSet;
-
// Methods ------------------------------------------------------------------
// Generates the cache key for this request.
@@ -309,6 +320,7 @@
// Used when lazily constructing the disk_cache_.
FilePath disk_cache_dir_;
+ MessageLoop* cache_thread_;
Mode mode_;
CacheType type_;
« no previous file with comments | « net/disk_cache/disk_cache.h ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698