summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_host.cc
diff options
context:
space:
mode:
authormichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 20:51:06 +0000
committermichaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-20 20:51:06 +0000
commit15f9cdedac1784a85dca7867858c905f0ed90d2b (patch)
treebb001e718240c0fd86aa43a55f4a76e978b72880 /webkit/appcache/appcache_host.cc
parentb89f7e4d3f98fffe88bd07a57c735e28c37e692c (diff)
downloadchromium_src-15f9cdedac1784a85dca7867858c905f0ed90d2b.zip
chromium_src-15f9cdedac1784a85dca7867858c905f0ed90d2b.tar.gz
chromium_src-15f9cdedac1784a85dca7867858c905f0ed90d2b.tar.bz2
Finally getting to the appcache parts instead of all of this webkitApi/ipc plumbing craziness.
BUG=39368 TEST=new unittests Review URL: http://codereview.chromium.org/2121002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47844 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_host.cc')
-rw-r--r--webkit/appcache/appcache_host.cc50
1 files changed, 45 insertions, 5 deletions
diff --git a/webkit/appcache/appcache_host.cc b/webkit/appcache/appcache_host.cc
index d4ca661..6d0336b 100644
--- a/webkit/appcache/appcache_host.cc
+++ b/webkit/appcache/appcache_host.cc
@@ -6,13 +6,15 @@
#include "base/logging.h"
#include "webkit/appcache/appcache.h"
+#include "webkit/appcache/appcache_backend_impl.h"
#include "webkit/appcache/appcache_request_handler.h"
namespace appcache {
AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend,
AppCacheService* service)
- : host_id_(host_id), pending_main_resource_cache_id_(kNoCacheId),
+ : host_id_(host_id), parent_host_id_(kNoHostId), parent_process_id_(0),
+ pending_main_resource_cache_id_(kNoCacheId),
pending_selected_cache_id_(kNoCacheId),
frontend_(frontend), service_(service),
pending_get_status_callback_(NULL), pending_start_update_callback_(NULL),
@@ -93,6 +95,31 @@ void AppCacheHost::SelectCache(const GURL& document_url,
FinishCacheSelection(NULL, NULL);
}
+void AppCacheHost::SelectCacheForWorker(int parent_process_id,
+ int parent_host_id) {
+ DCHECK(!pending_start_update_callback_ &&
+ !pending_swap_cache_callback_ &&
+ !pending_get_status_callback_ &&
+ !is_selection_pending());
+
+ parent_process_id_ = parent_process_id;
+ parent_host_id_ = parent_host_id;
+ FinishCacheSelection(NULL, NULL);
+}
+
+void AppCacheHost::SelectCacheForSharedWorker(int64 appcache_id) {
+ DCHECK(!pending_start_update_callback_ &&
+ !pending_swap_cache_callback_ &&
+ !pending_get_status_callback_ &&
+ !is_selection_pending());
+
+ if (appcache_id != kNoCacheId) {
+ LoadSelectedCache(appcache_id);
+ return;
+ }
+ FinishCacheSelection(NULL, NULL);
+}
+
// TODO(michaeln): change method name to MarkEntryAsForeign for consistency
void AppCacheHost::MarkAsForeignEntry(const GURL& document_url,
int64 cache_document_was_loaded_from) {
@@ -197,15 +224,28 @@ void AppCacheHost::DoPendingSwapCache() {
pending_callback_param_ = NULL;
}
+AppCacheHost* AppCacheHost::GetParentAppCacheHost() const {
+ DCHECK(is_for_dedicated_worker());
+ AppCacheBackendImpl* backend = service_->GetBackend(parent_process_id_);
+ return backend ? backend->GetHost(parent_host_id_) : NULL;
+}
+
AppCacheRequestHandler* AppCacheHost::CreateRequestHandler(
URLRequest* request,
- bool is_main_request) {
- if (is_main_request)
- return new AppCacheRequestHandler(this, true);
+ ResourceType::Type resource_type) {
+ if (is_for_dedicated_worker()) {
+ AppCacheHost* parent_host = GetParentAppCacheHost();
+ if (parent_host)
+ return parent_host->CreateRequestHandler(request, resource_type);
+ return NULL;
+ }
+
+ if (AppCacheRequestHandler::IsMainResourceType(resource_type))
+ return new AppCacheRequestHandler(this, resource_type);
if ((associated_cache() && associated_cache()->is_complete()) ||
is_selection_pending()) {
- return new AppCacheRequestHandler(this, false);
+ return new AppCacheRequestHandler(this, resource_type);
}
return NULL;
}