OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "webkit/appcache/appcache_service.h" | 5 #include "webkit/appcache/appcache_service.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "webkit/appcache/appcache.h" | 8 #include "webkit/appcache/appcache.h" |
9 #include "webkit/appcache/appcache_backend_impl.h" | 9 #include "webkit/appcache/appcache_backend_impl.h" |
10 #include "webkit/appcache/appcache_group.h" | 10 #include "webkit/appcache/appcache_group.h" |
11 | 11 |
12 namespace appcache { | 12 namespace appcache { |
13 | 13 |
| 14 AppCacheService::AppCacheService() |
| 15 : last_cache_id_(0), last_group_id_(0), |
| 16 last_entry_id_(0), last_response_id_(0) { |
| 17 } |
| 18 |
14 AppCacheService::~AppCacheService() { | 19 AppCacheService::~AppCacheService() { |
15 DCHECK(backends_.empty()); | 20 DCHECK(backends_.empty()); |
16 DCHECK(caches_.empty()); | 21 DCHECK(caches_.empty()); |
17 DCHECK(groups_.empty()); | 22 DCHECK(groups_.empty()); |
18 } | 23 } |
19 | 24 |
20 void AppCacheService::Initialize(const FilePath& cache_directory) { | 25 void AppCacheService::Initialize(const FilePath& cache_directory) { |
21 // An empty cache directory indicates chrome incognito. | 26 // An empty cache directory indicates chrome incognito. |
22 cache_directory_ = cache_directory; | 27 cache_directory_ = cache_directory; |
| 28 // TODO(michaeln): load last_<foo>_ids from storage |
23 } | 29 } |
24 | 30 |
25 void AppCacheService::RegisterBackend( | 31 void AppCacheService::RegisterBackend( |
26 AppCacheBackendImpl* backend_impl) { | 32 AppCacheBackendImpl* backend_impl) { |
27 DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); | 33 DCHECK(backends_.find(backend_impl->process_id()) == backends_.end()); |
28 backends_.insert( | 34 backends_.insert( |
29 BackendMap::value_type(backend_impl->process_id(), backend_impl)); | 35 BackendMap::value_type(backend_impl->process_id(), backend_impl)); |
30 } | 36 } |
31 | 37 |
32 void AppCacheService::UnregisterBackend( | 38 void AppCacheService::UnregisterBackend( |
(...skipping 15 matching lines...) Expand all Loading... |
48 const GURL& url = group->manifest_url(); | 54 const GURL& url = group->manifest_url(); |
49 DCHECK(groups_.find(url) == groups_.end()); | 55 DCHECK(groups_.find(url) == groups_.end()); |
50 groups_.insert(GroupMap::value_type(url, group)); | 56 groups_.insert(GroupMap::value_type(url, group)); |
51 } | 57 } |
52 | 58 |
53 void AppCacheService::RemoveGroup(AppCacheGroup* group) { | 59 void AppCacheService::RemoveGroup(AppCacheGroup* group) { |
54 groups_.erase(group->manifest_url()); | 60 groups_.erase(group->manifest_url()); |
55 } | 61 } |
56 | 62 |
57 } // namespace appcache | 63 } // namespace appcache |
OLD | NEW |