Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/service_worker/service_worker_storage.h" | 5 #include "content/browser/service_worker/service_worker_storage.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 450 FROM_HERE, | 450 FROM_HERE, |
| 451 base::Bind(&WriteRegistrationInDB, | 451 base::Bind(&WriteRegistrationInDB, |
| 452 database_.get(), | 452 database_.get(), |
| 453 base::MessageLoopProxy::current(), | 453 base::MessageLoopProxy::current(), |
| 454 data, resources, | 454 data, resources, |
| 455 base::Bind(&ServiceWorkerStorage::DidStoreRegistration, | 455 base::Bind(&ServiceWorkerStorage::DidStoreRegistration, |
| 456 weak_factory_.GetWeakPtr(), | 456 weak_factory_.GetWeakPtr(), |
| 457 callback))); | 457 callback))); |
| 458 | 458 |
| 459 registration->set_is_deleted(false); | 459 registration->set_is_deleted(false); |
| 460 | |
| 461 // TODO(dmurph): Add correct byte delta. | |
| 462 if (quota_manager_proxy_.get() != nullptr) { | |
|
michaeln
2014/10/14 00:50:31
nit: don't need to comparison to nullptr
dmurph
2014/10/14 21:04:50
Done.
| |
| 463 // Can be nullptr in tests. | |
| 464 quota_manager_proxy_->NotifyStorageModified( | |
| 465 storage::QuotaClient::kServiceWorker, | |
| 466 registration->pattern().GetOrigin(), | |
| 467 storage::StorageType::kStorageTypeTemporary, | |
| 468 0); | |
| 469 } | |
| 460 } | 470 } |
| 461 | 471 |
| 462 void ServiceWorkerStorage::UpdateToActiveState( | 472 void ServiceWorkerStorage::UpdateToActiveState( |
| 463 ServiceWorkerRegistration* registration, | 473 ServiceWorkerRegistration* registration, |
| 464 const StatusCallback& callback) { | 474 const StatusCallback& callback) { |
| 465 DCHECK(registration); | 475 DCHECK(registration); |
| 466 | 476 |
| 467 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; | 477 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; |
| 468 if (IsDisabled() || !context_) { | 478 if (IsDisabled() || !context_) { |
| 469 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); | 479 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1420 // Give up the corruption recovery until the browser restarts. | 1430 // Give up the corruption recovery until the browser restarts. |
| 1421 LOG(ERROR) << "Failed to delete the diskcache."; | 1431 LOG(ERROR) << "Failed to delete the diskcache."; |
| 1422 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1432 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
| 1423 return; | 1433 return; |
| 1424 } | 1434 } |
| 1425 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1435 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
| 1426 callback.Run(SERVICE_WORKER_OK); | 1436 callback.Run(SERVICE_WORKER_OK); |
| 1427 } | 1437 } |
| 1428 | 1438 |
| 1429 } // namespace content | 1439 } // namespace content |
| OLD | NEW |