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

Unified Diff: webkit/appcache/appcache_host.cc

Issue 3074015: Sending renderer notification when update job finishes (Used to notify cache ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/appcache/appcache_host.cc
===================================================================
--- webkit/appcache/appcache_host.cc (revision 54586)
+++ webkit/appcache/appcache_host.cc (working copy)
@@ -12,6 +12,24 @@
namespace appcache {
+namespace {
+
+void FillCacheInfo(
+ const AppCache* cache, Status status, AppCacheInfo* info) {
+ DCHECK(cache);
+ info->cache_id = cache->cache_id();
+ info->status = status;
+ info->is_complete = cache->is_complete();
+ if (info->is_complete) {
+ info->manifest_url = cache->owning_group()->manifest_url();
+ info->last_update_time = cache->update_time();
+ info->creation_time = cache->owning_group()->creation_time();
+ info->size = cache->cache_size();
+ }
+}
+
+} // Anonymous namespace
+
AppCacheHost::AppCacheHost(int host_id, AppCacheFrontend* frontend,
AppCacheService* service)
: host_id_(host_id), parent_host_id_(kNoHostId), parent_process_id_(0),
@@ -20,7 +38,7 @@
frontend_(frontend), service_(service),
pending_get_status_callback_(NULL), pending_start_update_callback_(NULL),
pending_swap_cache_callback_(NULL), pending_callback_param_(NULL),
- main_resource_blocked_(false) {
+ main_resource_blocked_(false), associated_cache_info_pending_(false) {
}
AppCacheHost::~AppCacheHost() {
@@ -396,6 +414,14 @@
group_being_updated_ = NULL;
newest_cache_of_group_being_updated_ = NULL;
+
+ if (associated_cache_info_pending_ && associated_cache_.get() &&
+ associated_cache_->is_complete()) {
+ AppCacheInfo info;
+ FillCacheInfo(associated_cache_.get(), GetStatus(), &info);
+ associated_cache_info_pending_ = false;
+ frontend_->OnCacheSelected(host_id_, info);
+ }
}
void AppCacheHost::OnContentBlocked(AppCacheGroup* group) {
@@ -436,24 +462,13 @@
associated_cache_ = cache;
SetSwappableCache(cache ? cache->owning_group() : NULL);
+ associated_cache_info_pending_ = cache && !cache->is_complete();
AppCacheInfo info;
if (cache) {
cache->AssociateHost(this);
- info.cache_id = cache->cache_id();
- info.status = GetStatus();
- info.is_complete = cache->is_complete();
- if (cache->is_complete()) {
- // TODO(kkanetkar): Get manifest URL info for NULL owning_group().
- info.manifest_url = cache->owning_group()->manifest_url();
- info.last_update_time = cache->update_time();
- info.creation_time = cache->owning_group()->creation_time();
- info.size = cache->cache_size();
- }
- frontend_->OnCacheSelected(host_id_, info);
- } else {
- // No Cache.
- frontend_->OnCacheSelected(host_id_, info);
+ FillCacheInfo(cache, GetStatus(), &info);
}
+ frontend_->OnCacheSelected(host_id_, info);
}
} // namespace appcache
« no previous file with comments | « webkit/appcache/appcache_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698