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 #ifndef WEBKIT_APPCACHE_APPCACHE_GROUP_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_GROUP_H_ |
6 #define WEBKIT_APPCACHE_APPCACHE_GROUP_H_ | 6 #define WEBKIT_APPCACHE_APPCACHE_GROUP_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 friend class AppCacheUpdateJobTest; | 79 friend class AppCacheUpdateJobTest; |
80 friend class MockAppCacheStorage; // for old_caches() | 80 friend class MockAppCacheStorage; // for old_caches() |
81 | 81 |
82 typedef std::vector<AppCache*> Caches; | 82 typedef std::vector<AppCache*> Caches; |
83 | 83 |
84 AppCacheUpdateJob* update_job() { return update_job_; } | 84 AppCacheUpdateJob* update_job() { return update_job_; } |
85 void SetUpdateStatus(UpdateStatus status); | 85 void SetUpdateStatus(UpdateStatus status); |
86 | 86 |
87 const Caches& old_caches() const { return old_caches_; } | 87 const Caches& old_caches() const { return old_caches_; } |
88 | 88 |
| 89 // Used by update process to restore the group's newest cache if storage |
| 90 // fails to store the newly created cache. |
| 91 void RestoreCacheAsNewest(AppCache* cache); |
| 92 |
89 GURL manifest_url_; | 93 GURL manifest_url_; |
90 UpdateStatus update_status_; | 94 UpdateStatus update_status_; |
91 bool is_obsolete_; | 95 bool is_obsolete_; |
92 | 96 |
93 // Old complete app caches. | 97 // Old complete app caches. |
94 Caches old_caches_; | 98 Caches old_caches_; |
95 | 99 |
96 // Newest cache in this group to be complete, aka relevant cache. | 100 // Newest cache in this group to be complete, aka relevant cache. |
97 AppCache* newest_complete_cache_; | 101 AppCache* newest_complete_cache_; |
98 | 102 |
99 // Current update job for this group, if any. | 103 // Current update job for this group, if any. |
100 AppCacheUpdateJob* update_job_; | 104 AppCacheUpdateJob* update_job_; |
101 | 105 |
102 // Central service object. | 106 // Central service object. |
103 AppCacheService* service_; | 107 AppCacheService* service_; |
104 | 108 |
105 // List of objects observing this group. | 109 // List of objects observing this group. |
106 ObserverList<UpdateObserver> observers_; | 110 ObserverList<UpdateObserver> observers_; |
107 | 111 |
108 FRIEND_TEST(AppCacheGroupTest, StartUpdate); | 112 FRIEND_TEST(AppCacheGroupTest, StartUpdate); |
109 FRIEND_TEST(AppCacheGroupTest, CancelUpdate); | 113 FRIEND_TEST(AppCacheGroupTest, CancelUpdate); |
110 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyChecking); | 114 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyChecking); |
111 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyDownloading); | 115 FRIEND_TEST(AppCacheUpdateJobTest, AlreadyDownloading); |
112 DISALLOW_COPY_AND_ASSIGN(AppCacheGroup); | 116 DISALLOW_COPY_AND_ASSIGN(AppCacheGroup); |
113 }; | 117 }; |
114 | 118 |
115 } // namespace appcache | 119 } // namespace appcache |
116 | 120 |
117 #endif // WEBKIT_APPCACHE_APPCACHE_GROUP_H_ | 121 #endif // WEBKIT_APPCACHE_APPCACHE_GROUP_H_ |
OLD | NEW |