| Index: content/browser/service_worker/service_worker_service_impl.cc
|
| diff --git a/content/browser/service_worker/service_worker_service_impl.cc b/content/browser/service_worker/service_worker_service_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5b7a58f7e9d0215c6e94c3d5e0ee5ed63748a84b
|
| --- /dev/null
|
| +++ b/content/browser/service_worker/service_worker_service_impl.cc
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/service_worker/service_worker_service_impl.h"
|
| +
|
| +#include "content/browser/service_worker/service_worker_context_core.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +
|
| +namespace content {
|
| +
|
| +ServiceWorkerServiceImpl::ServiceWorkerServiceImpl(
|
| + base::WeakPtr<ServiceWorkerContextCore> context,
|
| + blink::mojom::ServiceWorkerServiceRequest request)
|
| + : context_(context), binding_(this, std::move(request)) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + binding_.set_connection_error_handler(
|
| + base::Bind(&ServiceWorkerServiceImpl::OnConnectionError,
|
| + base::Unretained(this) /* the channel is owned by this */));
|
| +}
|
| +
|
| +ServiceWorkerServiceImpl::~ServiceWorkerServiceImpl() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +}
|
| +
|
| +void ServiceWorkerServiceImpl::ReplaceContext(
|
| + base::WeakPtr<ServiceWorkerContextCore> context) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + context_ = context;
|
| +}
|
| +
|
| +void ServiceWorkerServiceImpl::WorkerStarted(int32_t embedded_worker_id) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + LOG(ERROR) << "ServiceWorkerServiceImpl::WorkerStarted "
|
| + << embedded_worker_id;
|
| +}
|
| +
|
| +void ServiceWorkerServiceImpl::OnConnectionError() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + if (!context_)
|
| + return;
|
| + context_->ServiceHadConnectionError(this);
|
| + // |this| is now deleted.
|
| +}
|
| +
|
| +} // namespace content
|
|
|