Commit 3ccbc1aa authored by xiang.long's avatar xiang.long Committed by Commit bot

ServiceWorker: Fix DCHECK failures during DB recovery.

1. Register client to quota manager after it is initialized.
As the ServiceWorker cache storage is not affected during DB
recovery we don't need to create a new ServiceWorkerCacheStorageManager.

2. Ongoing register jobs could be aborted by DB recovery.

BUG=none

Review URL: https://codereview.chromium.org/943333007

Cr-Commit-Position: refs/heads/master@{#319044}
parent 3485fa9e
......@@ -141,8 +141,7 @@ ServiceWorkerContextCore::ServiceWorkerContextCore(
ServiceWorkerContextWrapper* wrapper)
: wrapper_(wrapper),
providers_(old_context->providers_.release()),
cache_manager_(ServiceWorkerCacheStorageManager::Create(
old_context->cache_manager())),
cache_manager_(old_context->cache_manager_.release()),
next_handle_id_(old_context->next_handle_id_),
next_registration_handle_id_(old_context->next_registration_handle_id_),
observer_list_(old_context->observer_list_),
......
......@@ -48,6 +48,9 @@ void GetServiceWorkerRegistrationStatusResponse(
return;
case SERVICE_WORKER_ERROR_ABORT:
*error_type = WebServiceWorkerError::ErrorTypeAbort;
return;
case SERVICE_WORKER_ERROR_IPC_FAILED:
case SERVICE_WORKER_ERROR_FAILED:
case SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND:
......
......@@ -57,7 +57,8 @@ void ServiceWorkerScriptCacheMap::NotifyFinishedCaching(
const std::string& status_message) {
DCHECK_NE(kInvalidServiceWorkerResponseId, LookupResourceId(url));
DCHECK(owner_->status() == ServiceWorkerVersion::NEW ||
owner_->status() == ServiceWorkerVersion::INSTALLING);
owner_->status() == ServiceWorkerVersion::INSTALLING ||
owner_->status() == ServiceWorkerVersion::REDUNDANT);
if (!context_)
return; // Our storage has been wiped via DeleteAndStartOver.
if (!status.is_success()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment