diff options
author | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 17:11:05 +0000 |
---|---|---|
committer | jennb@chromium.org <jennb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-16 17:11:05 +0000 |
commit | 43fdd14f0a15825532820cd6b12c233f2fd7be5a (patch) | |
tree | 29672c6892763c08989853392345758e03a84cf7 /webkit/appcache/appcache_update_job.h | |
parent | 46739a21804b7ee71eb8368609e2c3592334bc79 (diff) | |
download | chromium_src-43fdd14f0a15825532820cd6b12c233f2fd7be5a.zip chromium_src-43fdd14f0a15825532820cd6b12c233f2fd7be5a.tar.gz chromium_src-43fdd14f0a15825532820cd6b12c233f2fd7be5a.tar.bz2 |
Implement cancelling an appcache update. An update is cancelled when its application cache group is no longer in use. Refcounting of caches and groups changed to make cancelling an update work.
TEST=updated existing tests, verify deleting group cancels update, verify new refcounting behavior
BUG=none
Review URL: http://codereview.chromium.org/274013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_update_job.h')
-rw-r--r-- | webkit/appcache/appcache_update_job.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/webkit/appcache/appcache_update_job.h b/webkit/appcache/appcache_update_job.h index 0c19196..518404e 100644 --- a/webkit/appcache/appcache_update_job.h +++ b/webkit/appcache/appcache_update_job.h @@ -60,6 +60,7 @@ class AppCacheUpdateJob : public URLRequest::Delegate { REFETCH_MANIFEST, CACHE_FAILURE, CANCELLED, + COMPLETED, }; // Methods for URLRequest::Delegate. @@ -130,18 +131,14 @@ class AppCacheUpdateJob : public URLRequest::Delegate { // Does nothing if update process is still waiting for pending master // entries or URL fetches to complete downloading. Otherwise, completes // the update process. - // Returns true if update process is completed. - bool MaybeCompleteUpdate(); - - // Runs the cache failure steps after all pending master entry downloads - // have completed. - void HandleCacheFailure(); + void MaybeCompleteUpdate(); // Schedules a rerun of the entire update with the same parameters as // this update job after a short delay. void ScheduleUpdateRetry(int delay_ms); void Cancel(); + void DiscardInprogressCache(); // Deletes this object after letting the stack unwind. void DeleteSoon(); @@ -151,8 +148,16 @@ class AppCacheUpdateJob : public URLRequest::Delegate { GURL manifest_url_; // here for easier access AppCacheService* service_; + scoped_refptr<AppCache> inprogress_cache_; - scoped_refptr<AppCacheGroup> group_; + + // Hold a reference to the newly created cache until this update is + // destroyed. The host that started the update will add a reference to the + // new cache when notified that the update is complete. AppCacheGroup sends + // the notification when its status is set to IDLE in ~AppCacheUpdateJob. + scoped_refptr<AppCache> protect_new_cache_; + + AppCacheGroup* group_; UpdateType update_type_; InternalUpdateState internal_state_; |