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..66d2da804c8336f25faf013c21340201a22811c9 100644 |
--- a/content/browser/appcache/appcache_update_job.cc |
+++ b/content/browser/appcache/appcache_update_job.cc |
@@ -9,10 +9,12 @@ |
#include "base/compiler_specific.h" |
#include "base/message_loop/message_loop.h" |
#include "base/profiler/scoped_tracker.h" |
+#include "base/rand_util.h" |
#include "base/strings/string_util.h" |
#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 +373,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 +454,18 @@ void AppCacheUpdateJob::StartUpdate(AppCacheHost* host, |
is_new_pending_master_entry); |
} |
+ DelayableStart(); |
+} |
+ |
+void AppCacheUpdateJob::DelayableStart() { |
+ if (IsBrowserStartingUp()) { |
+ // Defer running update jobs till after startup. |
+ delayed_start_timer_.Start( |
+ FROM_HERE, base::TimeDelta::FromSeconds(base::RandInt(5, 15)), |
cmumford
2015/02/26 23:47:45
Constants for 5 & 15?
Also (I don't know RandInt
|
+ base::Bind(&AppCacheUpdateJob::DelayableStart, |
+ weak_factory_.GetWeakPtr())); |
+ return; |
+ } |
FetchManifest(true); |
} |