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

Unified Diff: chrome/browser/extensions/api/runtime/runtime_api.cc

Issue 12220109: Fix a bug where chrome.runtime.getBackgroundPage would return null if the event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/runtime/runtime_api.cc
diff --git a/chrome/browser/extensions/api/runtime/runtime_api.cc b/chrome/browser/extensions/api/runtime/runtime_api.cc
index 2d97e3a86b38caec46a87110904fb836e16ee170..4629804e7e1e9d1de123c99bb687ab1be7ee8d0e 100644
--- a/chrome/browser/extensions/api/runtime/runtime_api.cc
+++ b/chrome/browser/extensions/api/runtime/runtime_api.cc
@@ -132,17 +132,16 @@ void RuntimeEventRouter::DispatchOnUpdateAvailableEvent(
}
bool RuntimeGetBackgroundPageFunction::RunImpl() {
- ExtensionHost* host =
- ExtensionSystem::Get(profile())->process_manager()->
- GetBackgroundHostForExtension(extension_id());
- if (host) {
+ ExtensionSystem* system = ExtensionSystem::Get(profile());
+ ExtensionHost* host = system->process_manager()->
+ GetBackgroundHostForExtension(extension_id());
+ if (system->lazy_background_task_queue()->ShouldEnqueueTask(
+ profile(), GetExtension())) {
+ system->lazy_background_task_queue()->AddPendingTask(
+ profile(), extension_id(),
+ base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded, this));
+ } else if (host) {
OnPageLoaded(host);
- } else if (GetExtension()->has_lazy_background_page()) {
- ExtensionSystem::Get(profile())->lazy_background_task_queue()->
- AddPendingTask(
- profile(), extension_id(),
- base::Bind(&RuntimeGetBackgroundPageFunction::OnPageLoaded,
- this));
} else {
error_ = kNoBackgroundPageError;
return false;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698