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

Unified Diff: chrome/browser/extensions/extension_host.cc

Issue 182253010: Register a Service Worker when an extension is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test passes! Don't know if it's right though Created 6 years, 9 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 | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « chrome/browser/extensions/extension_host.h ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698