Chromium Code Reviews| 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 d7763f67ff545b8e967e1f91881ccb94c2ffc81e..f0d4e10c7142f6a5d64bfb7d428c34b1f036f267 100644 |
| --- a/content/child/service_worker/service_worker_provider_context.cc |
| +++ b/content/child/service_worker/service_worker_provider_context.cc |
| @@ -46,6 +46,11 @@ ServiceWorkerHandleReference* ServiceWorkerProviderContext::waiting() { |
| return waiting_.get(); |
| } |
| +ServiceWorkerHandleReference* ServiceWorkerProviderContext::active() { |
| + DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
| + return active_.get(); |
| +} |
| + |
| ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() { |
| DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
| return controller_.get(); |
| @@ -57,6 +62,8 @@ void ServiceWorkerProviderContext::OnServiceWorkerStateChanged( |
| ServiceWorkerHandleReference* which = NULL; |
| if (handle_id == controller_handle_id()) { |
| which = controller_.get(); |
| + } else if (handle_id == active_handle_id()) { |
| + which = active_.get(); |
|
michaeln
2014/07/09 02:07:05
style nit: these one line blocks don't need {}'s
nhiroki
2014/07/09 06:14:27
Done.
|
| } else if (handle_id == waiting_handle_id()) { |
| which = waiting_.get(); |
| } else if (handle_id == installing_handle_id()) { |
| @@ -87,6 +94,13 @@ void ServiceWorkerProviderContext::OnSetWaitingServiceWorker( |
| waiting_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); |
| } |
| +void ServiceWorkerProviderContext::OnSetActiveServiceWorker( |
| + int provider_id, |
| + const ServiceWorkerObjectInfo& info) { |
| + DCHECK_EQ(provider_id_, provider_id); |
| + active_ = ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_); |
| +} |
| + |
| void ServiceWorkerProviderContext::OnSetControllerServiceWorker( |
| int provider_id, |
| const ServiceWorkerObjectInfo& info) { |
| @@ -112,6 +126,12 @@ int ServiceWorkerProviderContext::waiting_handle_id() const { |
| : kInvalidServiceWorkerHandleId; |
| } |
| +int ServiceWorkerProviderContext::active_handle_id() const { |
| + DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
| + return active_ ? active_->info().handle_id |
| + : kInvalidServiceWorkerHandleId; |
| +} |
| + |
| int ServiceWorkerProviderContext::controller_handle_id() const { |
| DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread()); |
| return controller_ ? controller_->info().handle_id |