summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsorin@chromium.org <sorin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-11 13:44:38 +0000
committersorin@chromium.org <sorin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-11 13:44:38 +0000
commit10bc022d94a3a394687f08fd336b43d045e15361 (patch)
tree0c42a8ca7a653d0f0c9d9a72e91a5b5c189b2102 /chrome
parentc1788396329701011deed07c15156fdbb901bd1e (diff)
downloadchromium_src-10bc022d94a3a394687f08fd336b43d045e15361.zip
chromium_src-10bc022d94a3a394687f08fd336b43d045e15361.tar.gz
chromium_src-10bc022d94a3a394687f08fd336b43d045e15361.tar.bz2
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
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/component_updater/component_updater_service.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index f2518ea..135bca6 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -490,10 +490,23 @@ ComponentUpdateService::Status CrxUpdateService::RegisterComponent(
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;
}