| 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_group.h" | 5 #include "webkit/appcache/appcache_group.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "webkit/appcache/appcache.h" | 10 #include "webkit/appcache/appcache.h" |
| 11 #include "webkit/appcache/appcache_host.h" |
| 11 #include "webkit/appcache/appcache_service.h" | 12 #include "webkit/appcache/appcache_service.h" |
| 12 | 13 |
| 13 namespace appcache { | 14 namespace appcache { |
| 14 | 15 |
| 15 AppCacheGroup::AppCacheGroup(AppCacheService* service, | 16 AppCacheGroup::AppCacheGroup(AppCacheService* service, |
| 16 const GURL& manifest_url) | 17 const GURL& manifest_url) |
| 17 : manifest_url_(manifest_url), | 18 : manifest_url_(manifest_url), |
| 18 update_status_(IDLE), | 19 update_status_(IDLE), |
| 19 is_obsolete_(false), | 20 is_obsolete_(false), |
| 20 newest_complete_cache_(NULL), | 21 newest_complete_cache_(NULL), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Cannot remove newest cache if there are older caches as those may | 55 // Cannot remove newest cache if there are older caches as those may |
| 55 // eventually be swapped to the newest cache. | 56 // eventually be swapped to the newest cache. |
| 56 if (!old_caches_.empty()) | 57 if (!old_caches_.empty()) |
| 57 return false; | 58 return false; |
| 58 | 59 |
| 59 newest_complete_cache_->set_owning_group(NULL); | 60 newest_complete_cache_->set_owning_group(NULL); |
| 60 newest_complete_cache_ = NULL; | 61 newest_complete_cache_ = NULL; |
| 61 } else { | 62 } else { |
| 62 // Unused old cache can always be removed. | 63 // Unused old cache can always be removed. |
| 63 Caches::iterator it = | 64 Caches::iterator it = |
| 64 std::find(old_caches_.begin(), old_caches_.end(), cache); | 65 std::find(old_caches_.begin(), old_caches_.end(), cache); |
| 65 if (it != old_caches_.end()) { | 66 if (it != old_caches_.end()) { |
| 66 (*it)->set_owning_group(NULL); | 67 (*it)->set_owning_group(NULL); |
| 67 old_caches_.erase(it); | 68 old_caches_.erase(it); |
| 68 } | 69 } |
| 69 } | 70 } |
| 70 | 71 |
| 71 return true; | 72 return true; |
| 72 } | 73 } |
| 73 | 74 |
| 75 void AppCacheGroup::StartUpdateWithNewMasterEntry( |
| 76 AppCacheHost* host, const GURL& master_entry_url) { |
| 77 // TODO(michaeln): use the real AppCacheUpdateJob |
| 78 } |
| 79 |
| 74 } // namespace appcache | 80 } // namespace appcache |
| OLD | NEW |