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 "content/browser/appcache/appcache_group.h" | 5 #include "content/browser/appcache/appcache_group.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 void OnCacheSelectionComplete(AppCacheHost* host) override {} // N/A | 33 void OnCacheSelectionComplete(AppCacheHost* host) override {} // N/A |
34 void OnDestructionImminent(AppCacheHost* host) override { | 34 void OnDestructionImminent(AppCacheHost* host) override { |
35 group_->HostDestructionImminent(host); | 35 group_->HostDestructionImminent(host); |
36 } | 36 } |
37 private: | 37 private: |
38 AppCacheGroup* group_; | 38 AppCacheGroup* group_; |
39 }; | 39 }; |
40 | 40 |
41 AppCacheGroup::AppCacheGroup(AppCacheStorage* storage, | 41 AppCacheGroup::AppCacheGroup(AppCacheStorage* storage, |
42 const GURL& manifest_url, | 42 const GURL& manifest_url, |
43 int64 group_id) | 43 int64_t group_id) |
44 : group_id_(group_id), | 44 : group_id_(group_id), |
45 manifest_url_(manifest_url), | 45 manifest_url_(manifest_url), |
46 update_status_(IDLE), | 46 update_status_(IDLE), |
47 is_obsolete_(false), | 47 is_obsolete_(false), |
48 is_being_deleted_(false), | 48 is_being_deleted_(false), |
49 newest_complete_cache_(NULL), | 49 newest_complete_cache_(NULL), |
50 update_job_(NULL), | 50 update_job_(NULL), |
51 storage_(storage), | 51 storage_(storage), |
52 is_in_dtor_(false) { | 52 is_in_dtor_(false) { |
53 storage_->working_set()->AddGroup(this); | 53 storage_->working_set()->AddGroup(this); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 if (!is_obsolete() && old_caches_.empty() && | 131 if (!is_obsolete() && old_caches_.empty() && |
132 !newly_deletable_response_ids_.empty()) { | 132 !newly_deletable_response_ids_.empty()) { |
133 storage_->DeleteResponses(manifest_url_, newly_deletable_response_ids_); | 133 storage_->DeleteResponses(manifest_url_, newly_deletable_response_ids_); |
134 newly_deletable_response_ids_.clear(); | 134 newly_deletable_response_ids_.clear(); |
135 } | 135 } |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 void AppCacheGroup::AddNewlyDeletableResponseIds( | 139 void AppCacheGroup::AddNewlyDeletableResponseIds( |
140 std::vector<int64>* response_ids) { | 140 std::vector<int64_t>* response_ids) { |
141 if (is_being_deleted() || (!is_obsolete() && old_caches_.empty())) { | 141 if (is_being_deleted() || (!is_obsolete() && old_caches_.empty())) { |
142 storage_->DeleteResponses(manifest_url_, *response_ids); | 142 storage_->DeleteResponses(manifest_url_, *response_ids); |
143 response_ids->clear(); | 143 response_ids->clear(); |
144 return; | 144 return; |
145 } | 145 } |
146 | 146 |
147 if (newly_deletable_response_ids_.empty()) { | 147 if (newly_deletable_response_ids_.empty()) { |
148 newly_deletable_response_ids_.swap(*response_ids); | 148 newly_deletable_response_ids_.swap(*response_ids); |
149 return; | 149 return; |
150 } | 150 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // deletion by adding an extra ref in this scope (but only if we're not | 259 // deletion by adding an extra ref in this scope (but only if we're not |
260 // in our destructor). | 260 // in our destructor). |
261 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); | 261 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); |
262 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); | 262 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); |
263 if (!queued_updates_.empty()) | 263 if (!queued_updates_.empty()) |
264 ScheduleUpdateRestart(kUpdateRestartDelayMs); | 264 ScheduleUpdateRestart(kUpdateRestartDelayMs); |
265 } | 265 } |
266 } | 266 } |
267 | 267 |
268 } // namespace content | 268 } // namespace content |
OLD | NEW |