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

Unified Diff: webkit/appcache/appcache_backend_impl.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.h ('k') | webkit/appcache/appcache_backend_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_backend_impl.h
===================================================================
--- webkit/appcache/appcache_backend_impl.h (revision 26254)
+++ webkit/appcache/appcache_backend_impl.h (working copy)
@@ -5,22 +5,15 @@
#ifndef WEBKIT_APPCACHE_APPCACHE_BACKEND_IMPL_H_
#define WEBKIT_APPCACHE_APPCACHE_BACKEND_IMPL_H_
-#include <map>
-
#include "base/logging.h"
-#include "base/task.h"
+#include "base/hash_tables.h"
#include "webkit/appcache/appcache_host.h"
-#include "webkit/appcache/appcache_interfaces.h"
namespace appcache {
class AppCacheService;
-typedef Callback2<Status, void*>::Type GetStatusCallback;
-typedef Callback2<bool, void*>::Type StartUpdateCallback;
-typedef Callback2<bool, void*>::Type SwapCacheCallback;
-
-class AppCacheBackendImpl : public AppCacheBackend {
+class AppCacheBackendImpl {
public:
AppCacheBackendImpl() : service_(NULL), frontend_(NULL), process_id_(0) {}
~AppCacheBackendImpl();
@@ -31,38 +24,33 @@
int process_id() const { return process_id_; }
+ // Methods to support the AppCacheBackend interface. A false return
+ // value indicates an invalid host_id and that no action was taken
+ // by the backend impl.
+ bool RegisterHost(int host_id);
+ bool UnregisterHost(int host_id);
+ bool SelectCache(int host_id,
+ const GURL& document_url,
+ const int64 cache_document_was_loaded_from,
+ const GURL& manifest_url);
+ bool MarkAsForeignEntry(int host_id, const GURL& document_url,
+ int64 cache_document_was_loaded_from);
+ bool GetStatusWithCallback(int host_id, GetStatusCallback* callback,
+ void* callback_param);
+ bool StartUpdateWithCallback(int host_id, StartUpdateCallback* callback,
+ void* callback_param);
+ bool SwapCacheWithCallback(int host_id, SwapCacheCallback* callback,
+ void* callback_param);
+
// Returns a pointer to a registered host. The backend retains ownership.
AppCacheHost* GetHost(int host_id) {
HostMap::iterator it = hosts_.find(host_id);
- return (it != hosts_.end()) ? &(it->second) : NULL;
+ return (it != hosts_.end()) ? (it->second) : NULL;
}
- typedef std::map<int, AppCacheHost> HostMap;
+ typedef base::hash_map<int, AppCacheHost*> HostMap;
const HostMap& hosts() { return hosts_; }
- // AppCacheBackend methods
- virtual void RegisterHost(int host_id);
- virtual void UnregisterHost(int host_id);
- virtual void SelectCache(int host_id,
- const GURL& document_url,
- const int64 cache_document_was_loaded_from,
- const GURL& manifest_url);
- virtual void MarkAsForeignEntry(int host_id, const GURL& document_url,
- int64 cache_document_was_loaded_from);
-
- // We don't use the sync variants in the backend, would block the IO thread.
- virtual Status GetStatus(int host_id) { NOTREACHED(); return UNCACHED; }
- virtual bool StartUpdate(int host_id) { NOTREACHED(); return false; }
- virtual bool SwapCache(int host_id) { NOTREACHED(); return false; }
-
- // Async variants of the sync methods defined in the backend interface.
- void GetStatusWithCallback(int host_id, GetStatusCallback* callback,
- void* callback_param);
- void StartUpdateWithCallback(int host_id, StartUpdateCallback* callback,
- void* callback_param);
- void SwapCacheWithCallback(int host_id, SwapCacheCallback* callback,
- void* callback_param);
-
private:
AppCacheService* service_;
AppCacheFrontend* frontend_;
« no previous file with comments | « webkit/appcache/appcache.h ('k') | webkit/appcache/appcache_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698