Index: chrome/browser/extensions/lazy_background_task_queue.h |
diff --git a/chrome/browser/extensions/lazy_background_task_queue.h b/chrome/browser/extensions/lazy_background_task_queue.h |
index 70d1ac0a9c9e1790c949ed1e67cd500b3ce2c421..166bfa5605c4e65547a4e4de48ccd90d599ddcbf 100644 |
--- a/chrome/browser/extensions/lazy_background_task_queue.h |
+++ b/chrome/browser/extensions/lazy_background_task_queue.h |
@@ -38,15 +38,15 @@ class LazyBackgroundTaskQueue |
explicit LazyBackgroundTaskQueue(Profile* profile); |
virtual ~LazyBackgroundTaskQueue(); |
- // Returns true if the task should be added to the queue (that is, if the |
- // extension has a lazy background page that isn't ready yet). |
- bool ShouldEnqueueTask(Profile* profile, const Extension* extension); |
- |
// Adds a task to the queue for a given extension. If this is the first |
// task added for the extension, its lazy background page will be loaded. |
// The task will be called either when the page is loaded, or when the |
// page fails to load for some reason (e.g. a crash). In the latter case, |
- // the ExtensionHost parameter is NULL. |
+ // the ExtensionHost parameter is NULL. If there is currently a background |
+ // page available to handle the task, any suspend the page was in the middle |
+ // of will be canceled and the task will be executed with the background page |
+ // as an argument. If the extension id isn't lazy, |task| will be executed |
+ // straight away. |
void AddPendingTask( |
Profile* profile, |
const std::string& extension_id, |
@@ -62,9 +62,20 @@ class LazyBackgroundTaskQueue |
linked_ptr<PendingTasksList> > PendingTasksMap; |
typedef std::set<PendingTasksKey> PendingPageLoadList; |
+ // Returns true if the task should be added to the queue (that is, if the |
+ // extension has a lazy background page that isn't ready yet). |
+ bool ShouldEnqueueTask(Profile* profile, const Extension* extension); |
+ |
void StartLazyBackgroundPage(Profile* profile, |
const std::string& extension_id); |
+ // Executes |task| on an existing ExtensionHost if it exists. If the host is |
+ // in the middle of a suspend, that suspend is canceled. Returns true if |
+ // |task| was executed. |
+ bool ExecuteTaskNowIfPossible(Profile* profile, |
+ const std::string& extension_id, |
+ const PendingTask& task); |
+ |
// content::NotificationObserver interface. |
virtual void Observe(int type, |
const content::NotificationSource& source, |