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

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: address comments from Devlin + MichaelN 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
Index: extensions/browser/extension_function.h
diff --git a/extensions/browser/extension_function.h b/extensions/browser/extension_function.h
index dee9a4fe16ea0e27ceab6bf173f25dfdd8d04154..020548adea6e575acd45aa4123e92fc7642216b0 100644
--- a/extensions/browser/extension_function.h
+++ b/extensions/browser/extension_function.h
@@ -19,6 +19,7 @@
#include "base/process/process.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/timer/elapsed_timer.h"
+#include "content/common/service_worker/service_worker_types.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/console_message_level.h"
#include "extensions/browser/extension_function_histogram_value.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 content::kInvalidServiceWorkerVersionId !=
+ service_worker_version_id_;
Devlin 2016/10/06 16:35:12 nit: invert
lazyboy 2016/10/06 17:57:37 Done.
+ }
+
// 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_;

Powered by Google App Engine
This is Rietveld 408576698