summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_backend_impl.cc
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:30:30 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 22:30:30 +0000
commit23f1ef1a445a53bcefc8ddab9f4184b1db7321c5 (patch)
treec9f17a33025ed5b5c5dee76a7b4fef9104e9a995 /webkit/appcache/appcache_backend_impl.cc
parente143c823ce66af5a83a9a17b6f5938eb16e49392 (diff)
downloadchromium_src-23f1ef1a445a53bcefc8ddab9f4184b1db7321c5.zip
chromium_src-23f1ef1a445a53bcefc8ddab9f4184b1db7321c5.tar.gz
chromium_src-23f1ef1a445a53bcefc8ddab9f4184b1db7321c5.tar.bz2
Plumb request interception into the appcache library for both chrome and test_shell.
AppCache library: * Added AppCacheInterceptor, which is derived from URLRequest::Interceptor. Chrome: * Each UserProfile instantiates a ChromeAppCacheService, which is derived from an appcache library class. * Each ChromeURLRequestContext associated with that profile has a reference to that instance. * ResourceDispatcherHost pokes AppCacheInterceptor when initiating URLRequests and when returning the response head. TestShell: * Added SimpleAppCacheSystem which bundles together appcache lib components for use in a single process with an UI and IO thread. * TestShellWebKit instantiates and initializes an instance of the above, aimed at at temp directory that will get cleaned up when the test run is over. * SimpleResourceLoaderBridge pokes the system when initiating URLRequests and when returning the response head. TEST=none, although many existing tests exercise this stuff BUG=none Review URL: http://codereview.chromium.org/173406 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_backend_impl.cc')
-rw-r--r--webkit/appcache/appcache_backend_impl.cc48
1 files changed, 28 insertions, 20 deletions
diff --git a/webkit/appcache/appcache_backend_impl.cc b/webkit/appcache/appcache_backend_impl.cc
index 1c0cfc7..82b40ee 100644
--- a/webkit/appcache/appcache_backend_impl.cc
+++ b/webkit/appcache/appcache_backend_impl.cc
@@ -4,29 +4,34 @@
#include "webkit/appcache/appcache_backend_impl.h"
-#include "base/logging.h"
+#include "webkit/appcache/appcache_host.h"
+#include "webkit/appcache/appcache_service.h"
#include "webkit/appcache/web_application_cache_host_impl.h"
namespace appcache {
AppCacheBackendImpl::~AppCacheBackendImpl() {
- // TODO(michaeln): if (service_) service_->UnregisterFrontend(frontend_);
+ if (service_)
+ service_->UnregisterBackend(this);
}
void AppCacheBackendImpl::Initialize(AppCacheService* service,
- AppCacheFrontend* frontend) {
- DCHECK(!service_ && !frontend_ && frontend); // DCHECK(service)
+ AppCacheFrontend* frontend,
+ int process_id) {
+ DCHECK(!service_ && !frontend_ && frontend && service);
service_ = service;
frontend_ = frontend;
- // TODO(michaeln): service_->RegisterFrontend(frontend_);
+ process_id_ = process_id;
+ service_->RegisterBackend(this);
}
-void AppCacheBackendImpl::RegisterHost(int host_id) {
- // TODO(michaeln): plumb to service
+void AppCacheBackendImpl::RegisterHost(int id) {
+ DCHECK(hosts_.find(id) == hosts_.end());
+ hosts_.insert(HostMap::value_type(id, AppCacheHost(id, frontend_)));
}
-void AppCacheBackendImpl::UnregisterHost(int host_id) {
- // TODO(michaeln): plumb to service
+void AppCacheBackendImpl::UnregisterHost(int id) {
+ hosts_.erase(id);
}
void AppCacheBackendImpl::SelectCache(
@@ -34,7 +39,7 @@ void AppCacheBackendImpl::SelectCache(
const GURL& document_url,
const int64 cache_document_was_loaded_from,
const GURL& manifest_url) {
- // TODO(michaeln): plumb to service
+ // TODO(michaeln): write me
frontend_->OnCacheSelected(host_id, kNoCacheId, UNCACHED);
}
@@ -42,22 +47,25 @@ void AppCacheBackendImpl::MarkAsForeignEntry(
int host_id,
const GURL& document_url,
int64 cache_document_was_loaded_from) {
- // TODO(michaeln): plumb to service
+ // TODO(michaeln): write me
}
-Status AppCacheBackendImpl::GetStatus(int host_id) {
- // TODO(michaeln): plumb to service
- return UNCACHED;
+void AppCacheBackendImpl::GetStatusWithCallback(
+ int host_id, GetStatusCallback* callback, void* callback_param) {
+ // TODO(michaeln): write me
+ callback->Run(UNCACHED, callback_param);
}
-bool AppCacheBackendImpl::StartUpdate(int host_id) {
- // TODO(michaeln): plumb to service
- return false;
+void AppCacheBackendImpl::StartUpdateWithCallback(
+ int host_id, StartUpdateCallback* callback, void* callback_param) {
+ // TODO(michaeln): write me
+ callback->Run(false, callback_param);
}
-bool AppCacheBackendImpl::SwapCache(int host_id) {
- // TODO(michaeln): plumb to service
- return false;
+void AppCacheBackendImpl::SwapCacheWithCallback(
+ int host_id, SwapCacheCallback* callback, void* callback_param) {
+ // TODO(michaeln): write me
+ callback->Run(false, callback_param);
}
} // namespace appcache