OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/extensions/lazy_background_task_queue.h" | 5 #include "chrome/browser/extensions/lazy_background_task_queue.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 11 #include "chrome/browser/extensions/extension_process_manager.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/extensions/extension_system.h" | 13 #include "chrome/browser/extensions/extension_system.h" |
13 #include "chrome/browser/extensions/process_map.h" | 14 #include "chrome/browser/extensions/process_map.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/extensions/background_info.h" | 16 #include "chrome/common/extensions/background_info.h" |
16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 pm->CancelSuspend(extension); | 52 pm->CancelSuspend(extension); |
52 } | 53 } |
53 | 54 |
54 return false; | 55 return false; |
55 } | 56 } |
56 | 57 |
57 void LazyBackgroundTaskQueue::AddPendingTask( | 58 void LazyBackgroundTaskQueue::AddPendingTask( |
58 Profile* profile, | 59 Profile* profile, |
59 const std::string& extension_id, | 60 const std::string& extension_id, |
60 const PendingTask& task) { | 61 const PendingTask& task) { |
| 62 if (g_browser_process->IsShuttingDown()) { |
| 63 task.Run(NULL); |
| 64 return; |
| 65 } |
61 PendingTasksList* tasks_list = NULL; | 66 PendingTasksList* tasks_list = NULL; |
62 PendingTasksKey key(profile, extension_id); | 67 PendingTasksKey key(profile, extension_id); |
63 PendingTasksMap::iterator it = pending_tasks_.find(key); | 68 PendingTasksMap::iterator it = pending_tasks_.find(key); |
64 if (it == pending_tasks_.end()) { | 69 if (it == pending_tasks_.end()) { |
65 tasks_list = new PendingTasksList(); | 70 tasks_list = new PendingTasksList(); |
66 pending_tasks_[key] = linked_ptr<PendingTasksList>(tasks_list); | 71 pending_tasks_[key] = linked_ptr<PendingTasksList>(tasks_list); |
67 | 72 |
68 const Extension* extension = | 73 const Extension* extension = |
69 ExtensionSystem::Get(profile)->extension_service()-> | 74 ExtensionSystem::Get(profile)->extension_service()-> |
70 extensions()->GetByID(extension_id); | 75 extensions()->GetByID(extension_id); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 164 } |
160 break; | 165 break; |
161 } | 166 } |
162 default: | 167 default: |
163 NOTREACHED(); | 168 NOTREACHED(); |
164 break; | 169 break; |
165 } | 170 } |
166 } | 171 } |
167 | 172 |
168 } // namespace extensions | 173 } // namespace extensions |
OLD | NEW |