summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_update_job.cc
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 19:18:36 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-21 19:18:36 +0000
commit4252f6098889f2c5a8649d1688b269e53a51d42d (patch)
treebbb1040a665b91ac297685ee6b7add579822a911 /webkit/appcache/appcache_update_job.cc
parent29a6c9738ebb608d40567189452fd9c19f55569c (diff)
downloadchromium_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_update_job.cc')
-rw-r--r--webkit/appcache/appcache_update_job.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc
index e6bdf55..dd77329 100644
--- a/webkit/appcache/appcache_update_job.cc
+++ b/webkit/appcache/appcache_update_job.cc
@@ -382,7 +382,8 @@ void AppCacheUpdateJob::StartUpdate(AppCacheHost* host,
AppCacheResponseWriter* AppCacheUpdateJob::CreateResponseWriter() {
AppCacheResponseWriter* writer =
- service_->storage()->CreateResponseWriter(manifest_url_);
+ service_->storage()->CreateResponseWriter(manifest_url_,
+ group_->group_id());
stored_response_ids_.push_back(writer->response_id());
return writer;
}
@@ -414,7 +415,7 @@ void AppCacheUpdateJob::FetchManifest(bool is_first_fetch) {
group_->newest_complete_cache()->GetEntry(manifest_url_) : NULL;
if (entry) {
// Asynchronously load response info for manifest from newest cache.
- service_->storage()->LoadResponseInfo(manifest_url_,
+ service_->storage()->LoadResponseInfo(manifest_url_, group_->group_id(),
entry->response_id(), this);
} else {
manifest_fetcher_->Start();
@@ -561,6 +562,11 @@ void AppCacheUpdateJob::HandleUrlFetchCompleted(URLFetcher* fetcher) {
if (!inprogress_cache_->AddOrModifyEntry(url, entry))
duplicate_response_ids_.push_back(entry.response_id());
+ // TODO(michaeln): Check for <html manifest=xxx>
+ // See http://code.google.com/p/chromium/issues/detail?id=97930
+ // if (entry.IsMaster() && !entry.IsExplicit())
+ // if (!manifestAttribute) skip it
+
// Foreign entries will be detected during cache selection.
// Note: 6.9.4, step 17.9 possible optimization: if resource is HTML or XML
// file whose root element is an html element with a manifest attribute
@@ -848,6 +854,7 @@ void AppCacheUpdateJob::CheckIfManifestChanged() {
// Load manifest data from storage to compare against fetched manifest.
manifest_response_reader_.reset(
service_->storage()->CreateResponseReader(manifest_url_,
+ group_->group_id(),
entry->response_id()));
read_manifest_buffer_ = new net::IOBuffer(kBufferSize);
manifest_response_reader_->ReadData(read_manifest_buffer_, kBufferSize,
@@ -1111,7 +1118,8 @@ bool AppCacheUpdateJob::MaybeLoadFromNewestCache(const GURL& url,
// Load HTTP headers for entry from newest cache.
loading_responses_.insert(
LoadingResponses::value_type(copy_me->response_id(), url));
- service_->storage()->LoadResponseInfo(manifest_url_, copy_me->response_id(),
+ service_->storage()->LoadResponseInfo(manifest_url_, group_->group_id(),
+ copy_me->response_id(),
this);
// Async: wait for OnResponseInfoLoaded to complete.
return true;