| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 int response_code) OVERRIDE; | 180 int response_code) OVERRIDE; |
| 181 | 181 |
| 182 // Methods for AppCacheHost::Observer. | 182 // Methods for AppCacheHost::Observer. |
| 183 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A | 183 virtual void OnCacheSelectionComplete(AppCacheHost* host) OVERRIDE {} // N/A |
| 184 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; | 184 virtual void OnDestructionImminent(AppCacheHost* host) OVERRIDE; |
| 185 | 185 |
| 186 // Methods for AppCacheServiceImpl::Observer. | 186 // Methods for AppCacheServiceImpl::Observer. |
| 187 virtual void OnServiceReinitialized( | 187 virtual void OnServiceReinitialized( |
| 188 AppCacheStorageReference* old_storage) OVERRIDE; | 188 AppCacheStorageReference* old_storage) OVERRIDE; |
| 189 | 189 |
| 190 void HandleCacheFailure(const ErrorDetails& details, | 190 void HandleCacheFailure(const AppCacheErrorDetails& details, |
| 191 ResultType result, | 191 ResultType result, |
| 192 const GURL& failed_resource_url); | 192 const GURL& failed_resource_url); |
| 193 | 193 |
| 194 void FetchManifest(bool is_first_fetch); | 194 void FetchManifest(bool is_first_fetch); |
| 195 void HandleManifestFetchCompleted(URLFetcher* fetcher); | 195 void HandleManifestFetchCompleted(URLFetcher* fetcher); |
| 196 void ContinueHandleManifestFetchCompleted(bool changed); | 196 void ContinueHandleManifestFetchCompleted(bool changed); |
| 197 | 197 |
| 198 void HandleUrlFetchCompleted(URLFetcher* fetcher); | 198 void HandleUrlFetchCompleted(URLFetcher* fetcher); |
| 199 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); | 199 void HandleMasterEntryFetchCompleted(URLFetcher* fetcher); |
| 200 | 200 |
| 201 void HandleManifestRefetchCompleted(URLFetcher* fetcher); | 201 void HandleManifestRefetchCompleted(URLFetcher* fetcher); |
| 202 void OnManifestInfoWriteComplete(int result); | 202 void OnManifestInfoWriteComplete(int result); |
| 203 void OnManifestDataWriteComplete(int result); | 203 void OnManifestDataWriteComplete(int result); |
| 204 | 204 |
| 205 void StoreGroupAndCache(); | 205 void StoreGroupAndCache(); |
| 206 | 206 |
| 207 void NotifySingleHost(AppCacheHost* host, EventID event_id); | 207 void NotifySingleHost(AppCacheHost* host, AppCacheEventID event_id); |
| 208 void NotifyAllAssociatedHosts(EventID event_id); | 208 void NotifyAllAssociatedHosts(AppCacheEventID event_id); |
| 209 void NotifyAllProgress(const GURL& url); | 209 void NotifyAllProgress(const GURL& url); |
| 210 void NotifyAllFinalProgress(); | 210 void NotifyAllFinalProgress(); |
| 211 void NotifyAllError(const ErrorDetails& detals); | 211 void NotifyAllError(const AppCacheErrorDetails& detals); |
| 212 void LogConsoleMessageToAll(const std::string& message); | 212 void LogConsoleMessageToAll(const std::string& message); |
| 213 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); | 213 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); |
| 214 | 214 |
| 215 // Checks if manifest is byte for byte identical with the manifest | 215 // Checks if manifest is byte for byte identical with the manifest |
| 216 // in the newest application cache. | 216 // in the newest application cache. |
| 217 void CheckIfManifestChanged(); | 217 void CheckIfManifestChanged(); |
| 218 void OnManifestDataReadComplete(int result); | 218 void OnManifestDataReadComplete(int result); |
| 219 | 219 |
| 220 // Creates the list of files that may need to be fetched and initiates | 220 // Creates the list of files that may need to be fetched and initiates |
| 221 // fetches. Section 6.9.4 steps 12-17 | 221 // fetches. Section 6.9.4 steps 12-17 |
| 222 void BuildUrlFileList(const Manifest& manifest); | 222 void BuildUrlFileList(const Manifest& manifest); |
| 223 void AddUrlToFileList(const GURL& url, int type); | 223 void AddUrlToFileList(const GURL& url, int type); |
| 224 void FetchUrls(); | 224 void FetchUrls(); |
| 225 void CancelAllUrlFetches(); | 225 void CancelAllUrlFetches(); |
| 226 bool ShouldSkipUrlFetch(const AppCacheEntry& entry); | 226 bool ShouldSkipUrlFetch(const AppCacheEntry& entry); |
| 227 | 227 |
| 228 // If entry already exists in the cache currently being updated, merge | 228 // If entry already exists in the cache currently being updated, merge |
| 229 // the entry type information with the existing entry. | 229 // the entry type information with the existing entry. |
| 230 // Returns true if entry exists in cache currently being updated. | 230 // Returns true if entry exists in cache currently being updated. |
| 231 bool AlreadyFetchedEntry(const GURL& url, int entry_type); | 231 bool AlreadyFetchedEntry(const GURL& url, int entry_type); |
| 232 | 232 |
| 233 // TODO(jennb): Delete when update no longer fetches master entries directly. | 233 // TODO(jennb): Delete when update no longer fetches master entries directly. |
| 234 // Creates the list of master entries that need to be fetched and initiates | 234 // Creates the list of master entries that need to be fetched and initiates |
| 235 // fetches. | 235 // fetches. |
| 236 void AddMasterEntryToFetchList(AppCacheHost* host, const GURL& url, | 236 void AddMasterEntryToFetchList(AppCacheHost* host, const GURL& url, |
| 237 bool is_new); | 237 bool is_new); |
| 238 void FetchMasterEntries(); | 238 void FetchMasterEntries(); |
| 239 void CancelAllMasterEntryFetches(const ErrorDetails& details); | 239 void CancelAllMasterEntryFetches(const AppCacheErrorDetails& details); |
| 240 | 240 |
| 241 // Asynchronously loads the entry from the newest complete cache if the | 241 // Asynchronously loads the entry from the newest complete cache if the |
| 242 // HTTP caching semantics allow. | 242 // HTTP caching semantics allow. |
| 243 // Returns false if immediately obvious that data cannot be loaded from | 243 // Returns false if immediately obvious that data cannot be loaded from |
| 244 // newest complete cache. | 244 // newest complete cache. |
| 245 bool MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry); | 245 bool MaybeLoadFromNewestCache(const GURL& url, AppCacheEntry& entry); |
| 246 void LoadFromNewestCacheFailed(const GURL& url, | 246 void LoadFromNewestCacheFailed(const GURL& url, |
| 247 AppCacheResponseInfo* newest_response_info); | 247 AppCacheResponseInfo* newest_response_info); |
| 248 | 248 |
| 249 // Does nothing if update process is still waiting for pending master | 249 // Does nothing if update process is still waiting for pending master |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 AppCacheStorage* storage_; | 343 AppCacheStorage* storage_; |
| 344 | 344 |
| 345 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); | 345 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); |
| 346 | 346 |
| 347 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 347 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
| 348 }; | 348 }; |
| 349 | 349 |
| 350 } // namespace appcache | 350 } // namespace appcache |
| 351 | 351 |
| 352 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 352 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| OLD | NEW |