Index: content/browser/appcache/appcache_update_job.cc |
diff --git a/content/browser/appcache/appcache_update_job.cc b/content/browser/appcache/appcache_update_job.cc |
index 4848c9a5f15019ae07ff5a5c0dc7d26e7239e3b0..aff810f7c6917cfdb2f1d790945666b3ae5a2941 100644 |
--- a/content/browser/appcache/appcache_update_job.cc |
+++ b/content/browser/appcache/appcache_update_job.cc |
@@ -13,6 +13,7 @@ |
#include "base/strings/stringprintf.h" |
#include "content/browser/appcache/appcache_group.h" |
#include "content/browser/appcache/appcache_histograms.h" |
+#include "content/public/browser/browser_main_runner.h" |
#include "net/base/io_buffer.h" |
#include "net/base/load_flags.h" |
#include "net/base/net_errors.h" |
@@ -371,7 +372,8 @@ AppCacheUpdateJob::AppCacheUpdateJob(AppCacheServiceImpl* service, |
manifest_fetcher_(NULL), |
manifest_has_valid_mime_type_(false), |
stored_state_(UNSTORED), |
- storage_(service->storage()) { |
+ storage_(service->storage()), |
+ weak_factory_(this) { |
service_->AddObserver(this); |
} |
@@ -451,6 +453,19 @@ void AppCacheUpdateJob::StartUpdate(AppCacheHost* host, |
is_new_pending_master_entry); |
} |
+ DelayableStart(); |
+} |
+ |
+void AppCacheUpdateJob::DelayableStart() { |
+ if (IsBrowserStartingUp()) { |
+ // Defer running update jobs till after startup. |
+ const base::TimeDelta kRetryInterval = base::TimeDelta::FromSeconds(15); |
+ delayed_start_timer_.Start( |
+ FROM_HERE, kRetryInterval, |
+ base::Bind(&AppCacheUpdateJob::DelayableStart, |
+ weak_factory_.GetWeakPtr())); |
+ return; |
+ } |
FetchManifest(true); |
} |