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

Unified Diff: extensions/browser/extension_function.h

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/bad_message.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/extension_function.h
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h
index dee9a4fe16ea0e27ceab6bf173f25dfdd8d04154..2f358011fd040484934aa3e5705a8374aaf6115b 100644
--- a/extensions/browser/extension_function.h
+++ b/extensions/browser/extension_function.h
@@ -23,6 +23,7 @@
#include "content/public/common/console_message_level.h"
#include "extensions/browser/extension_function_histogram_value.h"
#include "extensions/browser/info_map.h"
+#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/features/feature.h"
#include "ipc/ipc_message.h"
@@ -518,8 +519,8 @@ class UIThreadExtensionFunction : public ExtensionFunction {
return dispatcher_.get();
}
- void set_is_from_service_worker(bool value) {
- is_from_service_worker_ = value;
+ void set_service_worker_version_id(int64_t version_id) {
+ service_worker_version_id_ = version_id;
}
// Gets the "current" web contents if any. If there is no associated web
@@ -557,15 +558,20 @@ class UIThreadExtensionFunction : public ExtensionFunction {
void Destruct() const override;
+ bool is_from_service_worker() const {
+ return service_worker_version_id_ !=
+ extensions::kInvalidServiceWorkerVersionId;
+ }
+
// The dispatcher that will service this extension function call.
base::WeakPtr<extensions::ExtensionFunctionDispatcher> dispatcher_;
// The RenderFrameHost we will send responses to.
content::RenderFrameHost* render_frame_host_;
- // Whether or not this ExtensionFunction was called by an extension Service
- // Worker.
- bool is_from_service_worker_;
+ // If this ExtensionFunction was called by an extension Service Worker, then
+ // this contains the worker's version id.
+ int64_t service_worker_version_id_;
std::unique_ptr<RenderFrameHostTracker> tracker_;
« no previous file with comments | « extensions/browser/bad_message.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698