Index: content/child/service_worker/service_worker_provider_context.cc |
diff --git a/content/child/service_worker/service_worker_provider_context.cc b/content/child/service_worker/service_worker_provider_context.cc |
index 3dfcff84e8cbf025ff64f75ee9627d9ec2a14e92..9eb7574151d097d62af3e933850a36409149324b 100644 |
--- a/content/child/service_worker/service_worker_provider_context.cc |
+++ b/content/child/service_worker/service_worker_provider_context.cc |
@@ -10,6 +10,7 @@ |
#include "content/child/child_thread.h" |
#include "content/child/service_worker/service_worker_dispatcher.h" |
#include "content/child/service_worker/service_worker_handle_reference.h" |
+#include "content/child/service_worker/service_worker_registration_handle_reference.h" |
#include "content/child/thread_safe_sender.h" |
#include "content/child/worker_task_runner.h" |
#include "content/common/service_worker/service_worker_messages.h" |
@@ -56,6 +57,12 @@ ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() { |
return controller_.get(); |
} |
+ServiceWorkerRegistrationHandleReference* |
+ServiceWorkerProviderContext::registration() { |
+ DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
+ return registration_.get(); |
+} |
+ |
void ServiceWorkerProviderContext::OnServiceWorkerStateChanged( |
int handle_id, |
blink::WebServiceWorkerState state) { |
@@ -117,6 +124,16 @@ void ServiceWorkerProviderContext::OnSetControllerServiceWorker( |
// when we support navigator.serviceWorker in dedicated workers. |
} |
+void ServiceWorkerProviderContext::AssociateRegistration( |
+ const ServiceWorkerRegistrationObjectInfo& info) { |
+ registration_ = ServiceWorkerRegistrationHandleReference::Adopt( |
+ info, thread_safe_sender_); |
+} |
+ |
+void ServiceWorkerProviderContext::UnassociateRegistration() { |
+ registration_.reset(); |
+} |
+ |
int ServiceWorkerProviderContext::installing_handle_id() const { |
DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
return installing_ ? installing_->info().handle_id |
@@ -141,4 +158,10 @@ int ServiceWorkerProviderContext::controller_handle_id() const { |
: kInvalidServiceWorkerHandleId; |
} |
+int ServiceWorkerProviderContext::registration_handle_id() const { |
+ DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
+ return registration_ ? registration_->info().handle_id |
+ : kInvalidServiceWorkerRegistrationHandleId; |
+} |
+ |
} // namespace content |