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

Unified Diff: content/browser/service_worker/service_worker_handle.h

Issue 261533003: Populate .current when navigator.serviceWorker is accessed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: content/browser/service_worker/service_worker_handle.h
diff --git a/content/browser/service_worker/service_worker_handle.h b/content/browser/service_worker/service_worker_handle.h
index 2aa7cc026f93aa6d331fe86fc6b1969d75be4b29..81d5b3574a242c62534508c2b2ed0764a58b5516 100644
--- a/content/browser/service_worker/service_worker_handle.h
+++ b/content/browser/service_worker/service_worker_handle.h
@@ -71,11 +71,16 @@ class CONTENT_EXPORT ServiceWorkerHandle
ServiceWorkerVersion* version() { return version_.get(); }
int handle_id() const { return handle_id_; }
+ bool HasNoRefCount() const { return ref_count_ <= 0; }
+ void IncrementRefCount();
+ void DecrementRefCount();
+
private:
base::WeakPtr<ServiceWorkerContextCore> context_;
IPC::Sender* sender_; // Not owned, it should always outlive this.
const int thread_id_;
const int handle_id_;
+ int ref_count_; // Created with 1.
scoped_refptr<ServiceWorkerRegistration> registration_;
scoped_refptr<ServiceWorkerVersion> version_;

Powered by Google App Engine
This is Rietveld 408576698