OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | |
csilv
2011/11/10 23:47:02
I don't see a need for this right now, unless you
James Hawkins
2011/11/11 19:30:39
Done.
| |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
11 #include "webkit/appcache/appcache.h" | 12 #include "webkit/appcache/appcache.h" |
12 #include "webkit/appcache/appcache_host.h" | 13 #include "webkit/appcache/appcache_host.h" |
13 #include "webkit/appcache/appcache_service.h" | 14 #include "webkit/appcache/appcache_service.h" |
14 #include "webkit/appcache/appcache_storage.h" | 15 #include "webkit/appcache/appcache_storage.h" |
15 #include "webkit/appcache/appcache_update_job.h" | 16 #include "webkit/appcache/appcache_update_job.h" |
16 | 17 |
17 namespace appcache { | 18 namespace appcache { |
18 | 19 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
223 } | 224 } |
224 | 225 |
225 bool AppCacheGroup::FindObserver(UpdateObserver* find_me, | 226 bool AppCacheGroup::FindObserver(UpdateObserver* find_me, |
226 const ObserverList<UpdateObserver>& observer_list) { | 227 const ObserverList<UpdateObserver>& observer_list) { |
227 return observer_list.HasObserver(find_me); | 228 return observer_list.HasObserver(find_me); |
228 } | 229 } |
229 | 230 |
230 void AppCacheGroup::ScheduleUpdateRestart(int delay_ms) { | 231 void AppCacheGroup::ScheduleUpdateRestart(int delay_ms) { |
231 DCHECK(!restart_update_task_); | 232 DCHECK(!restart_update_task_); |
232 restart_update_task_ = | 233 restart_update_task_ = |
233 NewRunnableMethod(this, &AppCacheGroup::RunQueuedUpdates); | 234 NewRunnableMethod(this, &AppCacheGroup::RunQueuedUpdates); |
csilv
2011/11/10 23:47:02
Do you want to convert this one?
James Hawkins
2011/11/11 19:30:39
|restart_update_task_| is a CancelableTask, so we
| |
234 MessageLoop::current()->PostDelayedTask(FROM_HERE, restart_update_task_, | 235 MessageLoop::current()->PostDelayedTask(FROM_HERE, restart_update_task_, |
235 delay_ms); | 236 delay_ms); |
236 } | 237 } |
237 | 238 |
238 void AppCacheGroup::HostDestructionImminent(AppCacheHost* host) { | 239 void AppCacheGroup::HostDestructionImminent(AppCacheHost* host) { |
239 queued_updates_.erase(host); | 240 queued_updates_.erase(host); |
240 if (queued_updates_.empty() && restart_update_task_) { | 241 if (queued_updates_.empty() && restart_update_task_) { |
241 restart_update_task_->Cancel(); | 242 restart_update_task_->Cancel(); |
242 restart_update_task_ = NULL; | 243 restart_update_task_ = NULL; |
243 } | 244 } |
(...skipping 14 matching lines...) Expand all Loading... | |
258 // 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 |
259 // in our destructor). | 260 // in our destructor). |
260 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); | 261 scoped_refptr<AppCacheGroup> protect(is_in_dtor_ ? NULL : this); |
261 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); | 262 FOR_EACH_OBSERVER(UpdateObserver, observers_, OnUpdateComplete(this)); |
262 if (!queued_updates_.empty()) | 263 if (!queued_updates_.empty()) |
263 ScheduleUpdateRestart(kUpdateRestartDelayMs); | 264 ScheduleUpdateRestart(kUpdateRestartDelayMs); |
264 } | 265 } |
265 } | 266 } |
266 | 267 |
267 } // namespace appcache | 268 } // namespace appcache |
OLD | NEW |