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

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: sync@tott Created 4 years, 2 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 | « extensions/browser/extension_function.h ('k') | extensions/browser/extension_function_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.cc
diff --git a/extensions/browser/extension_function.cc b/extensions/browser/extension_function.cc
index 5995ad1a3f2cce29bb295fe64479fd96a01ca324..587a50f66c818320b392b97c8bc03fc1fd9f97f0 100644
--- a/extensions/browser/extension_function.cc
+++ b/extensions/browser/extension_function.cc
@@ -450,11 +450,14 @@ void ExtensionFunction::SendResponseImpl(bool success) {
UIThreadExtensionFunction::UIThreadExtensionFunction()
: context_(nullptr),
render_frame_host_(nullptr),
- is_from_service_worker_(false) {}
+ service_worker_version_id_(extensions::kInvalidServiceWorkerVersionId) {}
UIThreadExtensionFunction::~UIThreadExtensionFunction() {
- if (dispatcher() && render_frame_host())
- dispatcher()->OnExtensionFunctionCompleted(extension());
+ if (dispatcher() && (render_frame_host() || is_from_service_worker())) {
+ dispatcher()->OnExtensionFunctionCompleted(extension(),
+ is_from_service_worker());
+ }
+
// The extension function should always respond to avoid leaks in the
// renderer, dangling callbacks, etc. The exception is if the system is
// shutting down.
@@ -503,7 +506,7 @@ void UIThreadExtensionFunction::Destruct() const {
void UIThreadExtensionFunction::SetRenderFrameHost(
content::RenderFrameHost* render_frame_host) {
// An extension function from Service Worker does not have a RenderFrameHost.
- if (is_from_service_worker_) {
+ if (is_from_service_worker()) {
DCHECK(!render_frame_host);
return;
}
« no previous file with comments | « extensions/browser/extension_function.h ('k') | extensions/browser/extension_function_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698