diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 10:30:25 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-09 10:30:25 +0000 |
commit | 80d42818b9f89df2089de425ebfb6784a5592581 (patch) | |
tree | 20caab18c7df619142a5958353aac06610a5b30f /webkit/appcache/appcache_storage.cc | |
parent | 3dfc5dc39fa4c3f9bf9b31be5958c5e8221a1830 (diff) | |
download | chromium_src-80d42818b9f89df2089de425ebfb6784a5592581.zip chromium_src-80d42818b9f89df2089de425ebfb6784a5592581.tar.gz chromium_src-80d42818b9f89df2089de425ebfb6784a5592581.tar.bz2 |
[GTTF] Reduce header dependencies in webkit
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/582015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38461 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_storage.cc')
-rw-r--r-- | webkit/appcache/appcache_storage.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_storage.cc b/webkit/appcache/appcache_storage.cc index eb0c23f..50565af 100644 --- a/webkit/appcache/appcache_storage.cc +++ b/webkit/appcache/appcache_storage.cc @@ -5,6 +5,7 @@ #include "webkit/appcache/appcache_storage.h" #include "base/stl_util-inl.h" +#include "webkit/appcache/appcache_response.h" namespace appcache { @@ -21,6 +22,40 @@ AppCacheStorage::~AppCacheStorage() { DCHECK(delegate_references_.empty()); } +AppCacheStorage::ResponseInfoLoadTask::ResponseInfoLoadTask( + const GURL& manifest_url, + int64 response_id, + AppCacheStorage* storage) + : storage_(storage), + manifest_url_(manifest_url), + response_id_(response_id), + info_buffer_(new HttpResponseInfoIOBuffer), + ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_( + this, &ResponseInfoLoadTask::OnReadComplete)) { + storage_->pending_info_loads_.insert( + PendingResponseInfoLoads::value_type(response_id, this)); +} + +void AppCacheStorage::ResponseInfoLoadTask::StartIfNeeded() { + if (reader_.get()) + return; + reader_.reset( + storage_->CreateResponseReader(manifest_url_, response_id_)); + reader_->ReadInfo(info_buffer_, &read_callback_); +} + +void AppCacheStorage::ResponseInfoLoadTask::OnReadComplete(int result) { + storage_->pending_info_loads_.erase(response_id_); + scoped_refptr<AppCacheResponseInfo> info; + if (result >= 0) { + info = new AppCacheResponseInfo(storage_->service(), manifest_url_, + response_id_, + info_buffer_->http_info.release()); + } + FOR_EACH_DELEGATE(delegates_, OnResponseInfoLoaded(info.get(), response_id_)); + delete this; +} + void AppCacheStorage::LoadResponseInfo( const GURL& manifest_url, int64 id, Delegate* delegate) { AppCacheResponseInfo* info = working_set_.GetResponseInfo(id); |