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

Unified Diff: extensions/browser/extension_function.cc

Issue 2166523003: Add ref count to service workers for extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index 8f737df200df1c93f460422afb50ebb1464137aa..d716ceb132ba763ac74df97f43a99c1e8b76ceb5 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -468,11 +468,15 @@ UIThreadExtensionFunction::UIThreadExtensionFunction()
: context_(nullptr),
render_frame_host_(nullptr),
is_from_service_worker_(false),
+ embedded_worker_id_(-1),
delegate_(nullptr) {}
UIThreadExtensionFunction::~UIThreadExtensionFunction() {
- if (dispatcher() && render_frame_host())
- dispatcher()->OnExtensionFunctionCompleted(extension());
+ if (dispatcher() && (render_frame_host() || is_from_service_worker_)) {
+ dispatcher()->OnExtensionFunctionCompleted(extension(),
+ embedded_worker_id_);
+ }
+
// The extension function should always respond to avoid leaks in the
// renderer, dangling callbacks, etc. The exception is if the system is
// shutting down.

Powered by Google App Engine
This is Rietveld 408576698