| 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 "webkit/browser/appcache/appcache_group.h" | 5 #include "webkit/browser/appcache/appcache_group.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 restart_update_task_.callback(), | 233 restart_update_task_.callback(), |
| 234 base::TimeDelta::FromMilliseconds(delay_ms)); | 234 base::TimeDelta::FromMilliseconds(delay_ms)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void AppCacheGroup::HostDestructionImminent(AppCacheHost* host) { | 237 void AppCacheGroup::HostDestructionImminent(AppCacheHost* host) { |
| 238 queued_updates_.erase(host); | 238 queued_updates_.erase(host); |
| 239 if (queued_updates_.empty() && !restart_update_task_.IsCancelled()) | 239 if (queued_updates_.empty() && !restart_update_task_.IsCancelled()) |
| 240 restart_update_task_.Cancel(); | 240 restart_update_task_.Cancel(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void AppCacheGroup::SetUpdateStatus(UpdateStatus status) { | 243 void AppCacheGroup::SetUpdateAppCacheStatus(UpdateAppCacheStatus status) { |
| 244 if (status == update_status_) | 244 if (status == update_status_) |
| 245 return; | 245 return; |
| 246 | 246 |
| 247 update_status_ = status; | 247 update_status_ = status; |
| 248 | 248 |
| 249 if (status != IDLE) { | 249 if (status != IDLE) { |
| 250 DCHECK(update_job_); | 250 DCHECK(update_job_); |
| 251 } else { | 251 } else { |
| 252 update_job_ = NULL; | 252 update_job_ = NULL; |
| 253 | 253 |
| 254 // Observers may release us in these callbacks, so we protect against | 254 // Observers may release us in these callbacks, so we protect against |
| 255 // deletion by adding an extra ref in this scope (but only if we're not | 255 // deletion by adding an extra ref in this scope (but only if we're not |
| 256 // in our destructor). | 256 // in our destructor). |
| 257 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); | 257 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); |
| 258 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); | 258 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); |
| 259 if (!queued_updates_.empty()) | 259 if (!queued_updates_.empty()) |
| 260 ScheduleUpdateRestart(kUpdateRestartDelayMs); | 260 ScheduleUpdateRestart(kUpdateRestartDelayMs); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace appcache | 264 } // namespace appcache |
| OLD | NEW |