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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "content/browser/appcache/appcache.h" | 12 #include "content/browser/appcache/appcache.h" |
13 #include "content/browser/appcache/appcache_host.h" | 13 #include "content/browser/appcache/appcache_host.h" |
14 #include "content/browser/appcache/appcache_service_impl.h" | 14 #include "content/browser/appcache/appcache_service_impl.h" |
15 #include "content/browser/appcache/appcache_storage.h" | 15 #include "content/browser/appcache/appcache_storage.h" |
16 #include "content/browser/appcache/appcache_update_job.h" | 16 #include "content/browser/appcache/appcache_update_job.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class AppCacheGroup; | 20 class AppCacheGroup; |
21 | 21 |
22 // Use this helper class because we cannot make AppCacheGroup a derived class | 22 // Use this helper class because we cannot make AppCacheGroup a derived class |
23 // of AppCacheHost::Observer as it would create a circular dependency between | 23 // of AppCacheHost::Observer as it would create a circular dependency between |
24 // AppCacheHost and AppCacheGroup. | 24 // AppCacheHost and AppCacheGroup. |
25 class AppCacheGroup::HostObserver : public AppCacheHost::Observer { | 25 class AppCacheGroup::HostObserver : public AppCacheHost::Observer { |
26 public: | 26 public: |
27 explicit HostObserver(AppCacheGroup* group) : group_(group) {} | 27 explicit HostObserver(AppCacheGroup* group) : group_(group) {} |
28 | 28 |
29 // Methods for AppCacheHost::Observer. | 29 // Methods for AppCacheHost::Observer. |
30 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A | 30 virtual void OnCacheSelectionComplete(AppCacheHost* host) override {} // N/A |
31 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE { | 31 virtual void OnDestructionImminent(AppCacheHost* host) override { |
32 group_->HostDestructionImminent(host); | 32 group_->HostDestructionImminent(host); |
33 } | 33 } |
34 private: | 34 private: |
35 AppCacheGroup* group_; | 35 AppCacheGroup* group_; |
36 }; | 36 }; |
37 | 37 |
38 AppCacheGroup::AppCacheGroup(AppCacheStorage* storage, | 38 AppCacheGroup::AppCacheGroup(AppCacheStorage* storage, |
39 const GURL& manifest_url, | 39 const GURL& manifest_url, |
40 int64 group_id) | 40 int64 group_id) |
41 : group_id_(group_id), | 41 : group_id_(group_id), |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 content | 264 } // namespace content |
OLD | NEW |