diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 23:10:09 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-26 23:10:09 +0000 |
commit | 49672df7e74a0633a0ee92e89b4daff904765638 (patch) | |
tree | de848215c76faf23ad3e99d456b8a056c8e61491 /webkit/appcache/appcache_service.cc | |
parent | c21b90496d356e5d8e56231dc8c4d4962a67f117 (diff) | |
download | chromium_src-49672df7e74a0633a0ee92e89b4daff904765638.zip chromium_src-49672df7e74a0633a0ee92e89b4daff904765638.tar.gz chromium_src-49672df7e74a0633a0ee92e89b4daff904765638.tar.bz2 |
Skeleton classes for appcache library framework. This is a work in progress. Committing early to allow other code to use these objects, but still need to consider refptrs and add unittests.
TEST=none (will add when classes are fleshed out more)
BUG=none
Review URL: http://codereview.chromium.org/174034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24554 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_service.cc')
-rw-r--r-- | webkit/appcache/appcache_service.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/webkit/appcache/appcache_service.cc b/webkit/appcache/appcache_service.cc new file mode 100644 index 0000000..0d3579b --- /dev/null +++ b/webkit/appcache/appcache_service.cc @@ -0,0 +1,50 @@ +// 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_service.h" + +#include "base/logging.h" +#include "webkit/appcache/appcache.h" +#include "webkit/appcache/appcache_backend_impl.h" +#include "webkit/appcache/appcache_group.h" + +namespace appcache { + +AppCacheService::~AppCacheService() { + DCHECK(backends_.empty()); + DCHECK(caches_.empty()); + DCHECK(groups_.empty()); +} + +void AppCacheService::RegisterBackendImpl( + AppCacheBackendImpl* backend_impl) { + backends_.insert(backend_impl); +} + +void AppCacheService::UnregisterBackendImpl( + AppCacheBackendImpl* backend_impl) { + backends_.erase(backend_impl); +} + +void AppCacheService::AddCache(AppCache* cache) { + int64 cache_id = cache->cache_id(); + DCHECK(caches_.find(cache_id) == caches_.end()); + caches_.insert(CacheMap::value_type(cache_id, cache)); +} + +void AppCacheService::RemoveCache(AppCache* cache) { + caches_.erase(cache->cache_id()); +} + +void AppCacheService::AddGroup(AppCacheGroup* group) { + const GURL& url = group->manifest_url(); + DCHECK(groups_.find(url) == groups_.end()); + groups_.insert(GroupMap::value_type(url, group)); +} + +void AppCacheService::RemoveGroup(AppCacheGroup* group) { + groups_.erase(group->manifest_url()); +} + +} // namespace appcache |