Component updater should wake up upon new component registration.
Upon registration of new components, we reset the timer, as if the
component were registered upfront.
BUG=379880
Review URL: https://codereview.chromium.org/325073002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276384 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index f2518ea..135bca66 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -490,10 +490,23 @@
uit->component = component;
work_items_.push_back(uit);
+
// If this is the first component registered we call Start to
- // schedule the first timer.
- if (running_ && (work_items_.size() == 1))
- Start();
+ // schedule the first timer. Otherwise, reset the timer to trigger another
+ // pass over the work items, if the component updater is sleeping, fact
+ // indicated by a running timer. If the timer is not running, it means that
+ // the service is busy updating something, and in that case, this component
+ // will be picked up at the next pass.
+ if (running_) {
+ if (work_items_.size() == 1) {
+ Start();
+ } else if (timer_.IsRunning()) {
+ timer_.Start(FROM_HERE,
+ base::TimeDelta::FromSeconds(config_->InitialDelay()),
+ this,
+ &CrxUpdateService::ProcessPendingItems);
+ }
+ }
return kOk;
}