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

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

Issue 421393002: Componentize component_updater: Split content::ResourceThrottle from CUS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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.h
diff --git a/chrome/browser/component_updater/component_updater_service.h b/chrome/browser/component_updater/component_updater_service.h
index 6dec6016c6b239a6f139ccab0d623263b7efa6f8..40e48ede7d995ac765f7b22a78c70fbb23848dc1 100644
--- a/chrome/browser/component_updater/component_updater_service.h
+++ b/chrome/browser/component_updater/component_updater_service.h
@@ -8,6 +8,7 @@
#include <string>
#include <vector>
+#include "base/callback_forward.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/version.h"
@@ -171,6 +172,21 @@ class ComponentUpdateService {
// proactively triggered outside the normal component update service schedule.
virtual OnDemandUpdater& GetOnDemandUpdater() = 0;
+ // This method is used to trigger an on-demand update for component |crx_id|.
+ // This can be used when loading a resource that depends on this component.
+ //
+ // |callback| is called on the main thread once the on-demand update is
+ // complete, regardless of success. |callback| may be called immediately
+ // within the method body.
+ //
+ // Additionally, this function implements an embedder-defined cooldown
+ // interval between on demand update attempts. This behavior is intended
+ // to be defensive against programming bugs, usually triggered by web fetches,
+ // where the on-demand functionality is invoked too often. If this function
+ // is called while still on cooldown, |callback| will be called immediately.
+ virtual void MaybeThrottle(const std::string& crx_id,
+ const base::Closure& callback) = 0;
+
// Returns a task runner suitable for use by component installers.
virtual scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner() = 0;
@@ -183,7 +199,6 @@ class ComponentUpdateService {
CrxUpdateItem* item) const = 0;
friend class ::ComponentsUI;
- FRIEND_TEST_ALL_PREFIXES(ComponentUpdaterTest, ResourceThrottleLiveNoUpdate);
};
typedef ComponentUpdateService::Observer ServiceObserver;
@@ -192,17 +207,6 @@ class OnDemandUpdater {
public:
virtual ~OnDemandUpdater() {}
- // Returns a network resource throttle. It means that a component will be
- // downloaded and installed before the resource is unthrottled. This function
- // can be called from the IO thread. The function implements a cooldown
- // interval of 30 minutes. That means it will ineffective to call the
- // function before the cooldown interval has passed. This behavior is intended
- // to be defensive against programming bugs, usually triggered by web fetches,
- // where the on-demand functionality is invoked too often.
- virtual content::ResourceThrottle* GetOnDemandResourceThrottle(
- net::URLRequest* request,
- const std::string& crx_id) = 0;
-
private:
friend class OnDemandTester;
friend class ::ComponentsUI;

Powered by Google App Engine
This is Rietveld 408576698