diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 19:18:36 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-21 19:18:36 +0000 |
commit | 4252f6098889f2c5a8649d1688b269e53a51d42d (patch) | |
tree | bbb1040a665b91ac297685ee6b7add579822a911 /webkit/appcache/appcache_request_handler.cc | |
parent | 29a6c9738ebb608d40567189452fd9c19f55569c (diff) | |
download | chromium_src-4252f6098889f2c5a8649d1688b269e53a51d42d.zip chromium_src-4252f6098889f2c5a8649d1688b269e53a51d42d.tar.gz chromium_src-4252f6098889f2c5a8649d1688b269e53a51d42d.tar.bz2 |
More groundwork for filestream based response storage.
This CL touches many files, but it amounts to mindless plumbing of a group_id value.
This doesn't involve any new database or fileio or task scheduling.
In order to read or write a response, callers now need to provide the group_id of
the corresponding manifest, so the AppCacheStorage CreateRepsonseReader() and
CreateResponseWriter() methods now take this additional parameter.
The current disk_cache based impl doesn't use this param for anything, but the
filestream based impl will use it to keep responses for a group in a particular
subdirectory.
When looking up the main resource for a page load via FindResponseForMainRequest,
the group_id needs to be returned so the response may later be read, the
AppCacheStorage::Delegate OnMainResponseFound() method has a param for that.
A bunch of callsites, tests, and mocks are updated accordingly.
BUG=78359
Review URL: http://codereview.chromium.org/8343018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106755 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_request_handler.cc')
-rw-r--r-- | webkit/appcache/appcache_request_handler.cc | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/webkit/appcache/appcache_request_handler.cc b/webkit/appcache/appcache_request_handler.cc index f4d74b1..dc55088 100644 --- a/webkit/appcache/appcache_request_handler.cc +++ b/webkit/appcache/appcache_request_handler.cc @@ -12,11 +12,12 @@ namespace appcache { -AppCacheRequestHandler::AppCacheRequestHandler(AppCacheHost* host, - ResourceType::Type resource_type) +AppCacheRequestHandler::AppCacheRequestHandler( + AppCacheHost* host, ResourceType::Type resource_type) : host_(host), resource_type_(resource_type), - is_waiting_for_cache_selection_(false), found_cache_id_(0), - found_network_namespace_(false), cache_entry_not_found_(false) { + is_waiting_for_cache_selection_(false), found_group_id_(0), + found_cache_id_(0), found_network_namespace_(false), + cache_entry_not_found_(false) { DCHECK(host_); host_->AddObserver(this); } @@ -103,8 +104,8 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect( // get the resource of the fallback entry. job_ = new AppCacheURLRequestJob(request, storage()); DeliverAppCachedResponse( - found_fallback_entry_, found_cache_id_, found_manifest_url_, - true, found_fallback_url_); + found_fallback_entry_, found_cache_id_, found_group_id_, + found_manifest_url_, true, found_fallback_url_); } else if (!found_network_namespace_) { // 6.9.6, step 6: Fail the resource load. job_ = new AppCacheURLRequestJob(request, storage()); @@ -155,8 +156,8 @@ AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse( // or there were network errors, get the resource of the fallback entry. job_ = new AppCacheURLRequestJob(request, storage()); DeliverAppCachedResponse( - found_fallback_entry_, found_cache_id_, found_manifest_url_, - true, found_fallback_url_); + found_fallback_entry_, found_cache_id_, found_group_id_, + found_manifest_url_, true, found_fallback_url_); return job_; } @@ -173,8 +174,8 @@ void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) { } void AppCacheRequestHandler::DeliverAppCachedResponse( - const AppCacheEntry& entry, int64 cache_id, const GURL& manifest_url, - bool is_fallback, const GURL& fallback_url) { + const AppCacheEntry& entry, int64 cache_id, int64 group_id, + const GURL& manifest_url, bool is_fallback, const GURL& fallback_url) { DCHECK(host_ && job_ && job_->is_waiting()); DCHECK(entry.has_response_id()); @@ -183,7 +184,8 @@ void AppCacheRequestHandler::DeliverAppCachedResponse( host_->NotifyMainResourceFallback(fallback_url); } - job_->DeliverAppCachedResponse(manifest_url, cache_id, entry, is_fallback); + job_->DeliverAppCachedResponse(manifest_url, group_id, cache_id, + entry, is_fallback); } void AppCacheRequestHandler::DeliverErrorResponse() { @@ -218,7 +220,7 @@ void AppCacheRequestHandler::MaybeLoadMainResource(net::URLRequest* request) { void AppCacheRequestHandler::OnMainResponseFound( const GURL& url, const AppCacheEntry& entry, const GURL& fallback_url, const AppCacheEntry& fallback_entry, - int64 cache_id, const GURL& manifest_url) { + int64 cache_id, int64 group_id, const GURL& manifest_url) { DCHECK(job_); DCHECK(host_); DCHECK(is_main_resource()); @@ -259,12 +261,13 @@ void AppCacheRequestHandler::OnMainResponseFound( found_fallback_url_ = fallback_url; found_fallback_entry_ = fallback_entry; found_cache_id_ = cache_id; + found_group_id_ = group_id; found_manifest_url_ = manifest_url; found_network_namespace_ = false; // not applicable to main requests if (found_entry_.has_response_id()) { DeliverAppCachedResponse( - found_entry_, found_cache_id_, found_manifest_url_, + found_entry_, found_cache_id_, found_group_id_, found_manifest_url_, false, GURL()); } else { DeliverNetworkResponse(); @@ -313,9 +316,10 @@ void AppCacheRequestHandler::ContinueMaybeLoadSubResource() { DCHECK(!found_network_namespace_ && !found_fallback_entry_.has_response_id()); found_cache_id_ = cache->cache_id(); + found_group_id_ = cache->owning_group()->group_id(); found_manifest_url_ = cache->owning_group()->manifest_url(); DeliverAppCachedResponse( - found_entry_, found_cache_id_, found_manifest_url_, + found_entry_, found_cache_id_, found_group_id_, found_manifest_url_, false, GURL()); return; } |