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 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success) OVERRIDE; | 168 virtual void OnGroupMadeObsolete(AppCacheGroup* group, bool success) OVERRIDE; |
169 | 169 |
170 // Methods for AppCacheHost::Observer. | 170 // Methods for AppCacheHost::Observer. |
171 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A | 171 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A |
172 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; | 172 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; |
173 | 173 |
174 // Methods for AppCacheService::Observer. | 174 // Methods for AppCacheService::Observer. |
175 virtual void OnServiceReinitialized( | 175 virtual void OnServiceReinitialized( |
176 AppCacheStorageReference* old_storage) OVERRIDE; | 176 AppCacheStorageReference* old_storage) OVERRIDE; |
177 | 177 |
178 void HandleCacheFailure(const std::string& error_message, ResultType result); | 178 void HandleCacheFailure(const std::string& error_message, |
| 179 ErrorReason reason, |
| 180 const GURL& resource_url, |
| 181 int resource_status, |
| 182 ResultType result); |
179 | 183 |
180 void FetchManifest(bool is_first_fetch); | 184 void FetchManifest(bool is_first_fetch); |
181 void HandleManifestFetchCompleted(URLFetcher* fetcher); | 185 void HandleManifestFetchCompleted(URLFetcher* fetcher); |
182 void ContinueHandleManifestFetchCompleted(bool changed); | 186 void ContinueHandleManifestFetchCompleted(bool changed); |
183 | 187 |
184 void HandleUrlFetchCompleted(URLFetcher* fetcher); | 188 void HandleUrlFetchCompleted(URLFetcher* fetcher); |
185 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); | 189 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); |
186 | 190 |
187 void HandleManifestRefetchCompleted(URLFetcher* fetcher); | 191 void HandleManifestRefetchCompleted(URLFetcher* fetcher); |
188 void OnManifestInfoWriteComplete(int result); | 192 void OnManifestInfoWriteComplete(int result); |
189 void OnManifestDataWriteComplete(int result); | 193 void OnManifestDataWriteComplete(int result); |
190 | 194 |
191 void StoreGroupAndCache(); | 195 void StoreGroupAndCache(); |
192 | 196 |
193 void NotifySingleHost(AppCacheHost* host, EventID event_id); | 197 void NotifySingleHost(AppCacheHost* host, EventID event_id); |
194 void NotifyAllAssociatedHosts(EventID event_id); | 198 void NotifyAllAssociatedHosts(EventID event_id); |
195 void NotifyAllProgress(const GURL& url); | 199 void NotifyAllProgress(const GURL& url); |
196 void NotifyAllFinalProgress(); | 200 void NotifyAllFinalProgress(); |
197 void NotifyAllError(const std::string& error_message); | 201 void NotifyAllError(const std::string& error_message, |
| 202 ErrorReason reason, |
| 203 const GURL& resource_url, |
| 204 int resource_status); |
198 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); | 205 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); |
199 | 206 |
200 // Checks if manifest is byte for byte identical with the manifest | 207 // Checks if manifest is byte for byte identical with the manifest |
201 // in the newest application cache. | 208 // in the newest application cache. |
202 void CheckIfManifestChanged(); | 209 void CheckIfManifestChanged(); |
203 void OnManifestDataReadComplete(int result); | 210 void OnManifestDataReadComplete(int result); |
204 | 211 |
205 // Creates the list of files that may need to be fetched and initiates | 212 // Creates the list of files that may need to be fetched and initiates |
206 // fetches. Section 6.9.4 steps 12-17 | 213 // fetches. Section 6.9.4 steps 12-17 |
207 void BuildUrlFileList(const Manifest& manifest); | 214 void BuildUrlFileList(const Manifest& manifest); |
208 void AddUrlToFileList(const GURL& url, int type); | 215 void AddUrlToFileList(const GURL& url, int type); |
209 void FetchUrls(); | 216 void FetchUrls(); |
210 void CancelAllUrlFetches(); | 217 void CancelAllUrlFetches(); |
211 bool ShouldSkipUrlFetch(const AppCacheEntry& entry); | 218 bool ShouldSkipUrlFetch(const AppCacheEntry& entry); |
212 | 219 |
213 // If entry already exists in the cache currently being updated, merge | 220 // If entry already exists in the cache currently being updated, merge |
214 // the entry type information with the existing entry. | 221 // the entry type information with the existing entry. |
215 // Returns true if entry exists in cache currently being updated. | 222 // Returns true if entry exists in cache currently being updated. |
216 bool AlreadyFetchedEntry(const GURL& url, int entry_type); | 223 bool AlreadyFetchedEntry(const GURL& url, int entry_type); |
217 | 224 |
218 // TODO(jennb): Delete when update no longer fetches master entries directly. | 225 // TODO(jennb): Delete when update no longer fetches master entries directly. |
219 // Creates the list of master entries that need to be fetched and initiates | 226 // Creates the list of master entries that need to be fetched and initiates |
220 // fetches. | 227 // fetches. |
221 void AddMasterEntryToFetchList(AppCacheHost* host, const GURL& url, | 228 void AddMasterEntryToFetchList(AppCacheHost* host, const GURL& url, |
222 bool is_new); | 229 bool is_new); |
223 void FetchMasterEntries(); | 230 void FetchMasterEntries(); |
224 void CancelAllMasterEntryFetches(const std::string& error_message); | 231 void CancelAllMasterEntryFetches(const std::string& error_message, |
| 232 ErrorReason reason, |
| 233 const GURL& resource_url, |
| 234 int resource_status); |
225 | 235 |
226 // Asynchronously loads the entry from the newest complete cache if the | 236 // Asynchronously loads the entry from the newest complete cache if the |
227 // HTTP caching semantics allow. | 237 // HTTP caching semantics allow. |
228 // Returns false if immediately obvious that data cannot be loaded from | 238 // Returns false if immediately obvious that data cannot be loaded from |
229 // newest complete cache. | 239 // newest complete cache. |
230 bool MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry); | 240 bool MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry); |
231 void LoadFromNewestCacheFailed(const GURL& url, | 241 void LoadFromNewestCacheFailed(const GURL& url, |
232 AppCacheResponseInfo* newest_response_info); | 242 AppCacheResponseInfo* newest_response_info); |
233 | 243 |
234 // Does nothing if update process is still waiting for pending master | 244 // Does nothing if update process is still waiting for pending master |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 AppCacheStorage* storage_; | 333 AppCacheStorage* storage_; |
324 | 334 |
325 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); | 335 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); |
326 | 336 |
327 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 337 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
328 }; | 338 }; |
329 | 339 |
330 } // namespace appcache | 340 } // namespace appcache |
331 | 341 |
332 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 342 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
OLD | NEW |