diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 18:09:33 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-21 18:09:33 +0000 |
commit | 073aabe9e48306216d979f03d6c2fc37d25d42e9 (patch) | |
tree | a9088a3c8be87fa57208074c7de65e998b865f94 /webkit/appcache/appcache_storage.cc | |
parent | c54d269e0b8a057533c1a1455a2acea0659629b9 (diff) | |
download | chromium_src-073aabe9e48306216d979f03d6c2fc37d25d42e9.zip chromium_src-073aabe9e48306216d979f03d6c2fc37d25d42e9.tar.gz chromium_src-073aabe9e48306216d979f03d6c2fc37d25d42e9.tar.bz2 |
AppCacheResponse storage implementation
* classes AppCacheResponseReader and AppCacheResponseWriter
* also implements AppCacheStorage.LoadResponseInfo()
* using a memory-backed disk_cache for now, so not really on disk yet
TEST=appcache_response_unittest.cc
BUG=none
Review URL: http://codereview.chromium.org/269062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29670 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_storage.cc')
-rw-r--r-- | webkit/appcache/appcache_storage.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_storage.cc b/webkit/appcache/appcache_storage.cc new file mode 100644 index 0000000..b1fc5c4 --- /dev/null +++ b/webkit/appcache/appcache_storage.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "webkit/appcache/appcache_storage.h" + +#include "base/stl_util-inl.h" + +namespace appcache { + +AppCacheStorage::AppCacheStorage(AppCacheService* service) + : last_cache_id_(kUnitializedId), last_group_id_(kUnitializedId), + last_entry_id_(kUnitializedId), last_response_id_(kUnitializedId), + service_(service) { +} + +AppCacheStorage::~AppCacheStorage() { + STLDeleteValues(&pending_info_loads_); + DCHECK(delegate_references_.empty()); +} + +void AppCacheStorage::LoadResponseInfo( + const GURL& manifest_url, int64 id, Delegate* delegate) { + AppCacheResponseInfo* info = working_set_.GetResponseInfo(id); + if (info) { + delegate->OnResponseInfoLoaded(info, id); + return; + } + ResponseInfoLoadTask* info_load = + GetOrCreateResponseInfoLoadTask(manifest_url, id); + DCHECK(manifest_url == info_load->manifest_url()); + DCHECK(id == info_load->response_id()); + info_load->AddDelegate(GetOrCreateDelegateReference(delegate)); + info_load->StartIfNeeded(); +} + +} // namespace appcache + |