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

Unified Diff: content/child/service_worker/web_service_worker_impl.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/child/service_worker/web_service_worker_impl.h
diff --git a/content/child/service_worker/web_service_worker_impl.h b/content/child/service_worker/web_service_worker_impl.h
index cf9728e5cbfffc7fb0f93bb1d5fa5b83fcae4556..0558b234e399d3f00421dbed11a7d50f059ab29c 100644
--- a/content/child/service_worker/web_service_worker_impl.h
+++ b/content/child/service_worker/web_service_worker_impl.h
@@ -20,14 +20,25 @@ class WebServiceWorkerProxy;
namespace content {
-class ThreadSafeSender;
+class ServiceWorkerHandleReference;
struct ServiceWorkerObjectInfo;
+class ThreadSafeSender;
+// Each instance corresponds to one ServiceWorker object in JS context, and
+// is held by ServiceWorker object in blink's c++ layer, e.g. created one
+// per navigator.serviceWorker.current or per successful
+// navigator.serviceWorker.register call.
+//
+// Each instance holds one ServiceWorkerHandleReference so that
+// corresponding ServiceWorkerHandle doesn't go away in the browser process
+// while the ServiceWorker object is alive.
class WebServiceWorkerImpl
: NON_EXPORTED_BASE(public blink::WebServiceWorker) {
public:
WebServiceWorkerImpl(const ServiceWorkerObjectInfo& info,
ThreadSafeSender* thread_safe_sender);
+ WebServiceWorkerImpl(scoped_ptr<ServiceWorkerHandleReference> handle_ref,
+ ThreadSafeSender* thread_safe_sender);
virtual ~WebServiceWorkerImpl();
// Notifies that the service worker's state changed. This function may queue
@@ -47,9 +58,7 @@ class WebServiceWorkerImpl
// Commits the new state internally and notifies the proxy of the change.
void ChangeState(blink::WebServiceWorkerState new_state);
- const int handle_id_;
- const GURL scope_;
- const GURL url_;
+ scoped_ptr<ServiceWorkerHandleReference> handle_ref_;
blink::WebServiceWorkerState state_;
scoped_refptr<ThreadSafeSender> thread_safe_sender_;
blink::WebServiceWorkerProxy* proxy_;

Powered by Google App Engine
This is Rietveld 408576698