Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Unified Diff: webkit/appcache/appcache_group.cc

Issue 201070: Implementation of application cache update algorithm.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/appcache/appcache_group.h ('k') | webkit/appcache/appcache_group_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_group.cc
===================================================================
--- webkit/appcache/appcache_group.cc (revision 26887)
+++ webkit/appcache/appcache_group.cc (working copy)
@@ -10,21 +10,24 @@
#include "webkit/appcache/appcache.h"
#include "webkit/appcache/appcache_host.h"
#include "webkit/appcache/appcache_service.h"
+#include "webkit/appcache/appcache_update_job.h"
namespace appcache {
AppCacheGroup::AppCacheGroup(AppCacheService* service,
const GURL& manifest_url)
- : manifest_url_(manifest_url),
- update_status_(IDLE),
- is_obsolete_(false),
- newest_complete_cache_(NULL),
- service_(service) {
+ : manifest_url_(manifest_url),
+ update_status_(IDLE),
+ is_obsolete_(false),
+ newest_complete_cache_(NULL),
+ update_job_(NULL),
+ service_(service) {
service_->AddGroup(this);
}
AppCacheGroup::~AppCacheGroup() {
DCHECK(old_caches_.empty());
+ DCHECK(!update_job_);
// Newest complete cache might never have been associated with a host
// and thus would not be cleaned up by the backend impl during shutdown.
@@ -34,6 +37,14 @@
service_->RemoveGroup(this);
}
+void AppCacheGroup::AddObserver(Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void AppCacheGroup::RemoveObserver(Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
void AppCacheGroup::AddCache(AppCache* complete_cache) {
DCHECK(complete_cache->is_complete());
if (!newest_complete_cache_) {
@@ -51,7 +62,6 @@
bool AppCacheGroup::RemoveCache(AppCache* cache) {
if (cache == newest_complete_cache_) {
-
// Cannot remove newest cache if there are older caches as those may
// eventually be swapped to the newest cache.
if (!old_caches_.empty())
@@ -73,8 +83,27 @@
}
void AppCacheGroup::StartUpdateWithNewMasterEntry(
- AppCacheHost* host, const GURL& master_entry_url) {
- // TODO(michaeln): use the real AppCacheUpdateJob
+ AppCacheHost* host, const GURL& new_master_resource) {
+ /* TODO(jennb): enable after have logic for cancelling an update
+ if (!update_job_)
+ update_job_ = new AppCacheUpdateJob(service_, this);
+
+ update_job_->StartUpdate(host, new_master_resource);
+ */
}
+void AppCacheGroup::SetUpdateStatus(UpdateStatus status) {
+ if (status == update_status_)
+ return;
+
+ update_status_ = status;
+
+ if (status != IDLE) {
+ DCHECK(update_job_);
+ } else {
+ update_job_ = NULL;
+ FOR_EACH_OBSERVER(Observer, observers_, OnUpdateComplete(this));
+ }
+}
+
} // namespace appcache
« no previous file with comments | « webkit/appcache/appcache_group.h ('k') | webkit/appcache/appcache_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698