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

Unified Diff: webkit/appcache/appcache_service.h

Issue 192043: AppCacheHost cache selection algorithm (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_request_handler.cc ('k') | webkit/appcache/appcache_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_service.h
===================================================================
--- webkit/appcache/appcache_service.h (revision 26254)
+++ webkit/appcache/appcache_service.h (working copy)
@@ -12,6 +12,7 @@
#include "base/hash_tables.h"
#include "base/file_path.h"
#include "base/ref_counted.h"
+#include "base/task.h"
#include "net/url_request/url_request_context.h"
#include "googleurl/src/gurl.h"
@@ -26,6 +27,17 @@
// exclusive access to it's cache_directory on disk.
class AppCacheService {
public:
+
+ class LoadClient {
+ public:
+ virtual ~LoadClient() {}
+
+ // If a load fails the object pointer will be NULL.
+ virtual void CacheLoadedCallback(AppCache* cache, int64 cache_id) = 0;
+ virtual void GroupLoadedCallback(AppCacheGroup* cache,
+ const GURL& manifest_url) = 0;
+ };
+
AppCacheService();
virtual ~AppCacheService();
@@ -42,30 +54,41 @@
// TODO(jennb): API to set service settings, like file paths for storage
- // track which processes are using this appcache service
+ // Track which processes are using this appcache service.
void RegisterBackend(AppCacheBackendImpl* backend_impl);
void UnregisterBackend(AppCacheBackendImpl* backend_impl);
+ AppCacheBackendImpl* GetBackend(int id) {
+ BackendMap::iterator it = backends_.find(id);
+ return (it != backends_.end()) ? it->second : NULL;
+ }
+ // Track what we have in or in-memory cache.
void AddCache(AppCache* cache);
void RemoveCache(AppCache* cache);
void AddGroup(AppCacheGroup* group);
void RemoveGroup(AppCacheGroup* group);
-
- AppCacheBackendImpl* GetBackend(int id) {
- BackendMap::iterator it = backends_.find(id);
- return (it != backends_.end()) ? it->second : NULL;
- }
-
AppCache* GetCache(int64 id) {
CacheMap::iterator it = caches_.find(id);
return (it != caches_.end()) ? it->second : NULL;
}
-
AppCacheGroup* GetGroup(const GURL& manifest_url) {
GroupMap::iterator it = groups_.find(manifest_url);
return (it != groups_.end()) ? it->second : NULL;
}
+ // Load caches and groups from storage. If the request object
+ // is already in memory, the client is called immediately
+ // without returning to the message loop.
+ void LoadCache(int64 id, LoadClient* client);
+ void LoadOrCreateGroup(const GURL& manifest_url,
+ LoadClient* client);
+
+ // Cancels pending callbacks for this client.
+ void CancelLoads(LoadClient* client);
+
+ // Updates in memory and persistent storage.
+ void MarkAsForeignEntry(const GURL& entry_url, int64 cache_id);
+
// The service generates unique storage ids for different object types.
int64 NewCacheId() { return ++last_cache_id_; }
int64 NewGroupId() { return ++last_group_id_; }
@@ -90,15 +113,14 @@
typedef std::map<int, AppCacheBackendImpl*> BackendMap;
BackendMap backends_;
+ // Where we save our data.
FilePath cache_directory_;
// Context for use during cache updates.
scoped_refptr<URLRequestContext> request_context_;
- // TODO(jennb): info about appcache storage
- // AppCacheDatabase db_;
- // DiskCache response_storage_;
-
+ // TODO(michaeln): cache and group loading book keeping.
+ // TODO(michaeln): database and response storage
// TODO(jennb): service state: e.g. reached quota?
};
« no previous file with comments | « webkit/appcache/appcache_request_handler.cc ('k') | webkit/appcache/appcache_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698