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

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

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.cc
diff --git a/content/browser/service_worker/service_worker_handle.cc b/content/browser/service_worker/service_worker_handle.cc
index cc57b6fa3fdf518d397e55d7a42c35d0867f817d..a07ab9e9d91004a287e849859f4f9d8cff46818d 100644
--- a/content/browser/service_worker/service_worker_handle.cc
+++ b/content/browser/service_worker/service_worker_handle.cc
@@ -63,6 +63,7 @@ ServiceWorkerHandle::ServiceWorkerHandle(
sender_(sender),
thread_id_(thread_id),
handle_id_(context.get() ? context->GetNewServiceWorkerHandleId() : -1),
+ ref_count_(1),
registration_(registration),
version_(version) {
version_->AddListener(this);
@@ -112,4 +113,14 @@ ServiceWorkerObjectInfo ServiceWorkerHandle::GetObjectInfo() {
return info;
}
+void ServiceWorkerHandle::IncrementRefCount() {
+ DCHECK_GT(ref_count_, 0);
+ ++ref_count_;
+}
+
+void ServiceWorkerHandle::DecrementRefCount() {
+ DCHECK_GE(ref_count_, 0);
+ --ref_count_;
+}
+
} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_handle.h ('k') | content/browser/service_worker/service_worker_provider_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698