summaryrefslogtreecommitdiffstats
path: root/webkit/appcache/appcache_service.cc
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/appcache/appcache_service.cc')
-rw-r--r--webkit/appcache/appcache_service.cc50
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