| 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 d8273aaef4607725d961b6f3a48340f38e9825d5..c606d06d3d536a6e6734e89a5a23c675e7970a0d 100644
|
| --- a/content/child/service_worker/service_worker_provider_context.cc
|
| +++ b/content/child/service_worker/service_worker_provider_context.cc
|
| @@ -5,8 +5,9 @@
|
| #include "content/child/service_worker/service_worker_provider_context.h"
|
|
|
| #include "base/bind.h"
|
| -#include "base/message_loop/message_loop_proxy.h"
|
| +#include "base/location.h"
|
| #include "base/stl_util.h"
|
| +#include "base/thread_task_runner_handle.h"
|
| #include "content/child/child_thread_impl.h"
|
| #include "content/child/service_worker/service_worker_dispatcher.h"
|
| #include "content/child/service_worker/service_worker_handle_reference.h"
|
| @@ -19,7 +20,7 @@ namespace content {
|
|
|
| ServiceWorkerProviderContext::ServiceWorkerProviderContext(int provider_id)
|
| : provider_id_(provider_id),
|
| - main_thread_loop_proxy_(base::MessageLoopProxy::current()) {
|
| + main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
|
| if (!ChildThreadImpl::current())
|
| return; // May be null in some tests.
|
| thread_safe_sender_ = ChildThreadImpl::current()->thread_safe_sender();
|
| @@ -39,7 +40,7 @@ ServiceWorkerProviderContext::~ServiceWorkerProviderContext() {
|
| }
|
|
|
| ServiceWorkerHandleReference* ServiceWorkerProviderContext::controller() {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| return controller_.get();
|
| }
|
|
|
| @@ -64,7 +65,7 @@ void ServiceWorkerProviderContext::SetVersionAttributes(
|
| ChangedVersionAttributesMask mask,
|
| const ServiceWorkerVersionAttributes& attrs) {
|
| base::AutoLock lock(lock_);
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| DCHECK(registration_);
|
|
|
| if (mask.installing_changed()) {
|
| @@ -85,7 +86,7 @@ void ServiceWorkerProviderContext::OnAssociateRegistration(
|
| const ServiceWorkerRegistrationObjectInfo& info,
|
| const ServiceWorkerVersionAttributes& attrs) {
|
| base::AutoLock lock(lock_);
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| DCHECK(!registration_);
|
| DCHECK_NE(kInvalidServiceWorkerRegistrationId, info.registration_id);
|
| DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, info.handle_id);
|
| @@ -102,7 +103,7 @@ void ServiceWorkerProviderContext::OnAssociateRegistration(
|
|
|
| void ServiceWorkerProviderContext::OnDisassociateRegistration() {
|
| base::AutoLock lock(lock_);
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
|
|
| controller_.reset();
|
| active_.reset();
|
| @@ -115,7 +116,7 @@ void ServiceWorkerProviderContext::OnServiceWorkerStateChanged(
|
| int handle_id,
|
| blink::WebServiceWorkerState state) {
|
| base::AutoLock lock(lock_);
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
|
|
| ServiceWorkerHandleReference* which = NULL;
|
| if (handle_id == controller_handle_id())
|
| @@ -139,7 +140,7 @@ void ServiceWorkerProviderContext::OnServiceWorkerStateChanged(
|
|
|
| void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
|
| const ServiceWorkerObjectInfo& info) {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| DCHECK(registration_);
|
|
|
| // This context is is the primary owner of this handle, keeps the
|
| @@ -152,38 +153,38 @@ void ServiceWorkerProviderContext::OnSetControllerServiceWorker(
|
| }
|
|
|
| int ServiceWorkerProviderContext::installing_handle_id() const {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| return installing_ ? installing_->info().handle_id
|
| : kInvalidServiceWorkerHandleId;
|
| }
|
|
|
| int ServiceWorkerProviderContext::waiting_handle_id() const {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| return waiting_ ? waiting_->info().handle_id
|
| : kInvalidServiceWorkerHandleId;
|
| }
|
|
|
| int ServiceWorkerProviderContext::active_handle_id() const {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| return active_ ? active_->info().handle_id
|
| : kInvalidServiceWorkerHandleId;
|
| }
|
|
|
| int ServiceWorkerProviderContext::controller_handle_id() const {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| return controller_ ? controller_->info().handle_id
|
| : kInvalidServiceWorkerHandleId;
|
| }
|
|
|
| int ServiceWorkerProviderContext::registration_handle_id() const {
|
| - DCHECK(main_thread_loop_proxy_->RunsTasksOnCurrentThread());
|
| + DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread());
|
| return registration_ ? registration_->info().handle_id
|
| : kInvalidServiceWorkerRegistrationHandleId;
|
| }
|
|
|
| void ServiceWorkerProviderContext::DestructOnMainThread() const {
|
| - if (!main_thread_loop_proxy_->RunsTasksOnCurrentThread() &&
|
| - main_thread_loop_proxy_->DeleteSoon(FROM_HERE, this)) {
|
| + if (!main_thread_task_runner_->RunsTasksOnCurrentThread() &&
|
| + main_thread_task_runner_->DeleteSoon(FROM_HERE, this)) {
|
| return;
|
| }
|
| delete this;
|
|
|