Commit 09510776 authored by jyasskin@chromium.org's avatar jyasskin@chromium.org

Don't try to load an event page to fire an event if the browser is shutting down.

BUG=276610

Review URL: https://chromiumcodereview.appspot.com/23537019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221311 0039d316-1c4b-4281-b951-d872f2087c98
parent ca690f9a
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/lazy_background_task_queue.h" #include "chrome/browser/extensions/lazy_background_task_queue.h"
#include "base/callback.h" #include "base/callback.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_host.h" #include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/extensions/extension_process_manager.h" #include "chrome/browser/extensions/extension_process_manager.h"
...@@ -58,6 +59,10 @@ void LazyBackgroundTaskQueue::AddPendingTask( ...@@ -58,6 +59,10 @@ void LazyBackgroundTaskQueue::AddPendingTask(
Profile* profile, Profile* profile,
const std::string& extension_id, const std::string& extension_id,
const PendingTask& task) { const PendingTask& task) {
if (g_browser_process->IsShuttingDown()) {
task.Run(NULL);
return;
}
PendingTasksList* tasks_list = NULL; PendingTasksList* tasks_list = NULL;
PendingTasksKey key(profile, extension_id); PendingTasksKey key(profile, extension_id);
PendingTasksMap::iterator it = pending_tasks_.find(key); PendingTasksMap::iterator it = pending_tasks_.find(key);
......
...@@ -42,8 +42,8 @@ class LazyBackgroundTaskQueue : public content::NotificationObserver { ...@@ -42,8 +42,8 @@ class LazyBackgroundTaskQueue : public content::NotificationObserver {
// Adds a task to the queue for a given extension. If this is the first // 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. // 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 // 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, // page fails to load for some reason (e.g. a crash or browser
// the ExtensionHost parameter is NULL. // shutdown). In the latter case, the ExtensionHost parameter is NULL.
void AddPendingTask( void AddPendingTask(
Profile* profile, Profile* profile,
const std::string& extension_id, const std::string& extension_id,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment