Index: chrome/browser/extensions/extension_host.cc |
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc |
index 8c66891594bfe219c32a8171b5245506a43645a8..4bccedf2cc2f2026c7f836daf808e23e5a54e9f3 100644 |
--- a/chrome/browser/extensions/extension_host.cc |
+++ b/chrome/browser/extensions/extension_host.cc |
@@ -180,13 +180,17 @@ bool ExtensionHost::IsRenderViewLive() const { |
return render_view_host()->IsRenderViewLive(); |
} |
-void ExtensionHost::CreateRenderViewSoon() { |
+void ExtensionHost::CreateRenderViewSoon(const base::Closure& continuation) { |
if ((render_process_host() && render_process_host()->HasConnection())) { |
// If the process is already started, go ahead and initialize the RenderView |
// synchronously. The process creation is the real meaty part that we want |
// to defer. |
CreateRenderViewNow(); |
+ if (!continuation.is_null()) |
+ continuation.Run(); |
} else { |
+ if (!continuation.is_null()) |
+ when_render_view_created_.push_back(continuation); |
ProcessCreationQueue::GetInstance()->CreateSoon(this); |
} |
} |
@@ -198,6 +202,13 @@ void ExtensionHost::CreateRenderViewNow() { |
// Connect orphaned dev-tools instances. |
delegate_->OnRenderViewCreatedForBackgroundPage(this); |
} |
+ std::vector<base::Closure> running; |
+ running.swap(when_render_view_created_); |
+ for (std::vector<base::Closure>::const_iterator it = running.begin(); |
+ it != running.end(); |
+ ++it) { |
+ it->Run(); |
+ } |
} |
const GURL& ExtensionHost::GetURL() const { |