OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "webkit/appcache/appcache.h" | 7 #include "webkit/appcache/appcache.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 owning_group_(NULL), | 21 owning_group_(NULL), |
22 online_whitelist_all_(false), | 22 online_whitelist_all_(false), |
23 is_complete_(false), | 23 is_complete_(false), |
24 cache_size_(0), | 24 cache_size_(0), |
25 service_(service) { | 25 service_(service) { |
26 service_->storage()->working_set()->AddCache(this); | 26 service_->storage()->working_set()->AddCache(this); |
27 } | 27 } |
28 | 28 |
29 AppCache::~AppCache() { | 29 AppCache::~AppCache() { |
30 DCHECK(associated_hosts_.empty()); | 30 DCHECK(associated_hosts_.empty()); |
31 if (owning_group_) { | 31 if (owning_group_.get()) { |
32 DCHECK(is_complete_); | 32 DCHECK(is_complete_); |
33 owning_group_->RemoveCache(this); | 33 owning_group_->RemoveCache(this); |
34 } | 34 } |
35 DCHECK(!owning_group_); | 35 DCHECK(!owning_group_.get()); |
36 service_->storage()->working_set()->RemoveCache(this); | 36 service_->storage()->working_set()->RemoveCache(this); |
37 } | 37 } |
38 | 38 |
39 void AppCache::UnassociateHost(AppCacheHost* host) { | 39 void AppCache::UnassociateHost(AppCacheHost* host) { |
40 associated_hosts_.erase(host); | 40 associated_hosts_.erase(host); |
41 } | 41 } |
42 | 42 |
43 void AppCache::AddEntry(const GURL& url, const AppCacheEntry& entry) { | 43 void AppCache::AddEntry(const GURL& url, const AppCacheEntry& entry) { |
44 DCHECK(entries_.find(url) == entries_.end()); | 44 DCHECK(entries_.find(url) == entries_.end()); |
45 entries_.insert(EntryMap::value_type(url, entry)); | 45 entries_.insert(EntryMap::value_type(url, entry)); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // structures and algorithms that can be applied here and above. | 301 // structures and algorithms that can be applied here and above. |
302 size_t count = namespaces.size(); | 302 size_t count = namespaces.size(); |
303 for (size_t i = 0; i < count; ++i) { | 303 for (size_t i = 0; i < count; ++i) { |
304 if (StartsWithASCII(url.spec(), namespaces[i].spec(), true)) | 304 if (StartsWithASCII(url.spec(), namespaces[i].spec(), true)) |
305 return true; | 305 return true; |
306 } | 306 } |
307 return false; | 307 return false; |
308 } | 308 } |
309 | 309 |
310 } // namespace appcache | 310 } // namespace appcache |
OLD | NEW |