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 "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 bool LazyBackgroundTaskQueue::ShouldEnqueueTask( | 43 bool LazyBackgroundTaskQueue::ShouldEnqueueTask( |
44 Profile* profile, const Extension* extension) { | 44 Profile* profile, const Extension* extension) { |
45 DCHECK(extension); | 45 DCHECK(extension); |
46 if (extension->has_lazy_background_page()) { | 46 if (extension->has_lazy_background_page()) { |
47 ExtensionProcessManager* pm = | 47 ExtensionProcessManager* pm = |
48 ExtensionSystem::Get(profile)->process_manager(); | 48 ExtensionSystem::Get(profile)->process_manager(); |
49 ExtensionHost* background_host = | 49 ExtensionHost* background_host = |
50 pm->GetBackgroundHostForExtension(extension->id()); | 50 pm->GetBackgroundHostForExtension(extension->id()); |
51 if (!background_host || !background_host->did_stop_loading() || | 51 if (!background_host || !background_host->did_stop_loading()) |
52 pm->IsBackgroundHostClosing(extension->id())) | |
53 return true; | 52 return true; |
| 53 if (pm->IsBackgroundHostClosing(extension->id())) |
| 54 pm->CancelSuspend(extension); |
54 } | 55 } |
55 | 56 |
56 return false; | 57 return false; |
57 } | 58 } |
58 | 59 |
59 void LazyBackgroundTaskQueue::AddPendingTask( | 60 void LazyBackgroundTaskQueue::AddPendingTask( |
60 Profile* profile, | 61 Profile* profile, |
61 const std::string& extension_id, | 62 const std::string& extension_id, |
62 const PendingTask& task) { | 63 const PendingTask& task) { |
63 PendingTasksList* tasks_list = NULL; | 64 PendingTasksList* tasks_list = NULL; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 185 } |
185 break; | 186 break; |
186 } | 187 } |
187 default: | 188 default: |
188 NOTREACHED(); | 189 NOTREACHED(); |
189 break; | 190 break; |
190 } | 191 } |
191 } | 192 } |
192 | 193 |
193 } // namespace extensions | 194 } // namespace extensions |
OLD | NEW |