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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, EventID event_id); |
208 void NotifyAllAssociatedHosts(EventID event_id); | 208 void NotifyAllAssociatedHosts(EventID 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 ErrorDetails& detals); |
| 212 void LogConsoleMessageToAll(const std::string& message); |
212 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); | 213 void AddAllAssociatedHostsToNotifier(HostNotifier* notifier); |
213 | 214 |
214 // Checks if manifest is byte for byte identical with the manifest | 215 // Checks if manifest is byte for byte identical with the manifest |
215 // in the newest application cache. | 216 // in the newest application cache. |
216 void CheckIfManifestChanged(); | 217 void CheckIfManifestChanged(); |
217 void OnManifestDataReadComplete(int result); | 218 void OnManifestDataReadComplete(int result); |
218 | 219 |
219 // 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 |
220 // fetches. Section 6.9.4 steps 12-17 | 221 // fetches. Section 6.9.4 steps 12-17 |
221 void BuildUrlFileList(const Manifest& manifest); | 222 void BuildUrlFileList(const Manifest& manifest); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 URLFetcher* manifest_fetcher_; | 313 URLFetcher* manifest_fetcher_; |
313 PendingUrlFetches pending_url_fetches_; | 314 PendingUrlFetches pending_url_fetches_; |
314 | 315 |
315 // Temporary storage of manifest response data for parsing and comparison. | 316 // Temporary storage of manifest response data for parsing and comparison. |
316 std::string manifest_data_; | 317 std::string manifest_data_; |
317 scoped_ptr<net::HttpResponseInfo> manifest_response_info_; | 318 scoped_ptr<net::HttpResponseInfo> manifest_response_info_; |
318 scoped_ptr<AppCacheResponseWriter> manifest_response_writer_; | 319 scoped_ptr<AppCacheResponseWriter> manifest_response_writer_; |
319 scoped_refptr<net::IOBuffer> read_manifest_buffer_; | 320 scoped_refptr<net::IOBuffer> read_manifest_buffer_; |
320 std::string loaded_manifest_data_; | 321 std::string loaded_manifest_data_; |
321 scoped_ptr<AppCacheResponseReader> manifest_response_reader_; | 322 scoped_ptr<AppCacheResponseReader> manifest_response_reader_; |
| 323 bool manifest_has_valid_mime_type_; |
322 | 324 |
323 // New master entries added to the cache by this job, used to cleanup | 325 // New master entries added to the cache by this job, used to cleanup |
324 // in error conditions. | 326 // in error conditions. |
325 std::vector<GURL> added_master_entries_; | 327 std::vector<GURL> added_master_entries_; |
326 | 328 |
327 // Response ids stored by this update job, used to cleanup in | 329 // Response ids stored by this update job, used to cleanup in |
328 // error conditions. | 330 // error conditions. |
329 std::vector<int64> stored_response_ids_; | 331 std::vector<int64> stored_response_ids_; |
330 | 332 |
331 // In some cases we fetch the same resource multiple times, and then | 333 // In some cases we fetch the same resource multiple times, and then |
332 // have to delete the duplicates upon successful update. These ids | 334 // have to delete the duplicates upon successful update. These ids |
333 // are also in the stored_response_ids_ collection so we only schedule | 335 // are also in the stored_response_ids_ collection so we only schedule |
334 // these for deletion on success. | 336 // these for deletion on success. |
335 // TODO(michaeln): Rework when we no longer fetches master entries directly. | 337 // TODO(michaeln): Rework when we no longer fetches master entries directly. |
336 std::vector<int64> duplicate_response_ids_; | 338 std::vector<int64> duplicate_response_ids_; |
337 | 339 |
338 // Whether we've stored the resulting group/cache yet. | 340 // Whether we've stored the resulting group/cache yet. |
339 StoredState stored_state_; | 341 StoredState stored_state_; |
340 | 342 |
341 AppCacheStorage* storage_; | 343 AppCacheStorage* storage_; |
342 | 344 |
343 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); | 345 FRIEND_TEST_ALL_PREFIXES(content::AppCacheGroupTest, QueueUpdate); |
344 | 346 |
345 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 347 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
346 }; | 348 }; |
347 | 349 |
348 } // namespace appcache | 350 } // namespace appcache |
349 | 351 |
350 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 352 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
OLD | NEW |