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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 FROM_HERE, | 467 FROM_HERE, |
468 base::Bind(&WriteRegistrationInDB, | 468 base::Bind(&WriteRegistrationInDB, |
469 database_.get(), | 469 database_.get(), |
470 base::MessageLoopProxy::current(), | 470 base::MessageLoopProxy::current(), |
471 data, resources, | 471 data, resources, |
472 base::Bind(&ServiceWorkerStorage::DidStoreRegistration, | 472 base::Bind(&ServiceWorkerStorage::DidStoreRegistration, |
473 weak_factory_.GetWeakPtr(), | 473 weak_factory_.GetWeakPtr(), |
474 callback))); | 474 callback))); |
475 | 475 |
476 registration->set_is_deleted(false); | 476 registration->set_is_deleted(false); |
477 | |
478 // TODO(dmurph): Add correct byte delta. | |
479 if (quota_manager_proxy_.get()) { | |
480 // Can be nullptr in tests. | |
481 quota_manager_proxy_->NotifyStorageModified( | |
482 storage::QuotaClient::kServiceWorker, | |
483 registration->pattern().GetOrigin(), | |
484 storage::StorageType::kStorageTypeTemporary, | |
485 0); | |
486 } | |
487 } | 477 } |
488 | 478 |
489 void ServiceWorkerStorage::UpdateToActiveState( | 479 void ServiceWorkerStorage::UpdateToActiveState( |
490 ServiceWorkerRegistration* registration, | 480 ServiceWorkerRegistration* registration, |
491 const StatusCallback& callback) { | 481 const StatusCallback& callback) { |
492 DCHECK(registration); | 482 DCHECK(registration); |
493 | 483 |
494 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; | 484 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; |
495 if (IsDisabled() || !context_) { | 485 if (IsDisabled() || !context_) { |
496 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); | 486 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 // Give up the corruption recovery until the browser restarts. | 1438 // Give up the corruption recovery until the browser restarts. |
1449 LOG(ERROR) << "Failed to delete the diskcache."; | 1439 LOG(ERROR) << "Failed to delete the diskcache."; |
1450 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1440 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
1451 return; | 1441 return; |
1452 } | 1442 } |
1453 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1443 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
1454 callback.Run(SERVICE_WORKER_OK); | 1444 callback.Run(SERVICE_WORKER_OK); |
1455 } | 1445 } |
1456 | 1446 |
1457 } // namespace content | 1447 } // namespace content |
OLD | NEW |