| OLD | NEW |
| 1 // Copyright (c) 2011 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_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 6 #define WEBKIT_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> |
| 11 #include <string> | 11 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 34 public AppCacheHost::Observer { | 34 public AppCacheHost::Observer { |
| 35 public: | 35 public: |
| 36 AppCacheUpdateJob(AppCacheService* service, AppCacheGroup* group); | 36 AppCacheUpdateJob(AppCacheService* service, AppCacheGroup* group); |
| 37 virtual ~AppCacheUpdateJob(); | 37 virtual ~AppCacheUpdateJob(); |
| 38 | 38 |
| 39 // Triggers the update process or adds more info if this update is already | 39 // Triggers the update process or adds more info if this update is already |
| 40 // in progress. | 40 // in progress. |
| 41 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource); | 41 void StartUpdate(AppCacheHost* host, const GURL& new_master_resource); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 friend class ScopedRunnableMethodFactory<AppCacheUpdateJob>; | |
| 45 friend class AppCacheUpdateJobTest; | 44 friend class AppCacheUpdateJobTest; |
| 46 class URLFetcher; | 45 class URLFetcher; |
| 47 | 46 |
| 48 // Master entries have multiple hosts, for example, the same page is opened | 47 // Master entries have multiple hosts, for example, the same page is opened |
| 49 // in different tabs. | 48 // in different tabs. |
| 50 typedef std::vector<AppCacheHost*> PendingHosts; | 49 typedef std::vector<AppCacheHost*> PendingHosts; |
| 51 typedef std::map<GURL, PendingHosts> PendingMasters; | 50 typedef std::map<GURL, PendingHosts> PendingMasters; |
| 52 typedef std::map<GURL, URLFetcher*> PendingUrlFetches; | 51 typedef std::map<GURL, URLFetcher*> PendingUrlFetches; |
| 53 typedef std::map<int64, GURL> LoadingResponses; | 52 typedef std::map<int64, GURL> LoadingResponses; |
| 54 | 53 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 void ClearPendingMasterEntries(); | 229 void ClearPendingMasterEntries(); |
| 231 void DiscardInprogressCache(); | 230 void DiscardInprogressCache(); |
| 232 void DiscardDuplicateResponses(); | 231 void DiscardDuplicateResponses(); |
| 233 | 232 |
| 234 // Deletes this object after letting the stack unwind. | 233 // Deletes this object after letting the stack unwind. |
| 235 void DeleteSoon(); | 234 void DeleteSoon(); |
| 236 | 235 |
| 237 bool IsTerminating() { return internal_state_ >= REFETCH_MANIFEST || | 236 bool IsTerminating() { return internal_state_ >= REFETCH_MANIFEST || |
| 238 stored_state_ != UNSTORED; } | 237 stored_state_ != UNSTORED; } |
| 239 | 238 |
| 240 // This factory will be used to schedule invocations of various methods. | |
| 241 ScopedRunnableMethodFactory<AppCacheUpdateJob> method_factory_; | |
| 242 | |
| 243 GURL manifest_url_; // here for easier access | 239 GURL manifest_url_; // here for easier access |
| 244 AppCacheService* service_; | 240 AppCacheService* service_; |
| 245 | 241 |
| 246 scoped_refptr<AppCache> inprogress_cache_; | 242 scoped_refptr<AppCache> inprogress_cache_; |
| 247 | 243 |
| 248 AppCacheGroup* group_; | 244 AppCacheGroup* group_; |
| 249 | 245 |
| 250 UpdateType update_type_; | 246 UpdateType update_type_; |
| 251 InternalUpdateState internal_state_; | 247 InternalUpdateState internal_state_; |
| 252 | 248 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 StoredState stored_state_; | 301 StoredState stored_state_; |
| 306 | 302 |
| 307 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); | 303 FRIEND_TEST_ALL_PREFIXES(AppCacheGroupTest, QueueUpdate); |
| 308 | 304 |
| 309 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); | 305 DISALLOW_COPY_AND_ASSIGN(AppCacheUpdateJob); |
| 310 }; | 306 }; |
| 311 | 307 |
| 312 } // namespace appcache | 308 } // namespace appcache |
| 313 | 309 |
| 314 #endif // WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ | 310 #endif // WEBKIT_APPCACHE_APPCACHE_UPDATE_JOB_H_ |
| OLD | NEW |