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

Unified Diff: chrome/browser/component_updater/component_updater_service.cc

Issue 313373004: Eliminate the cooldown for direct calls to on-demand updates in CUS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
Index: chrome/browser/component_updater/component_updater_service.cc
diff --git a/chrome/browser/component_updater/component_updater_service.cc b/chrome/browser/component_updater/component_updater_service.cc
index 2277cd26e552e7003d77f6ed78d2450972aaa207..f2518ea19991b784b87826dff2da6c76c82d919b 100644
--- a/chrome/browser/component_updater/component_updater_service.cc
+++ b/chrome/browser/component_updater/component_updater_service.cc
@@ -201,6 +201,7 @@ class CrxUpdateService : public ComponentUpdateService, public OnDemandUpdater {
const CrxDownloader::Result& download_result);
Status OnDemandUpdateInternal(CrxUpdateItem* item);
+ Status OnDemandUpdateWithCooldown(CrxUpdateItem* item);
void ProcessPendingItems();
@@ -956,7 +957,7 @@ void CrxUpdateService::OnNewResourceThrottle(
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Check if we can on-demand update, else unblock the request anyway.
CrxUpdateItem* item = FindUpdateItemById(crx_id);
- Status status = OnDemandUpdateInternal(item);
+ Status status = OnDemandUpdateWithCooldown(item);
if (status == kOk || status == kInProgress) {
item->throttles.push_back(rt);
return;
@@ -972,7 +973,7 @@ ComponentUpdateService::Status CrxUpdateService::OnDemandUpdate(
return OnDemandUpdateInternal(FindUpdateItemById(component_id));
}
-ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateInternal(
+ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateWithCooldown(
CrxUpdateItem* uit) {
if (!uit)
return kError;
@@ -982,6 +983,14 @@ ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateInternal(
if (delta < base::TimeDelta::FromSeconds(config_->OnDemandDelay()))
return kError;
+ return OnDemandUpdateInternal(uit);
+}
+
+ComponentUpdateService::Status CrxUpdateService::OnDemandUpdateInternal(
+ CrxUpdateItem* uit) {
+ if (!uit)
+ return kError;
+
Status service_status = GetServiceStatus(uit->status);
// If the item is already in the process of being updated, there is
// no point in this call, so return kInProgress.

Powered by Google App Engine
This is Rietveld 408576698