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 } |
477 } | 487 } |
478 | 488 |
479 void ServiceWorkerStorage::UpdateToActiveState( | 489 void ServiceWorkerStorage::UpdateToActiveState( |
480 ServiceWorkerRegistration* registration, | 490 ServiceWorkerRegistration* registration, |
481 const StatusCallback& callback) { | 491 const StatusCallback& callback) { |
482 DCHECK(registration); | 492 DCHECK(registration); |
483 | 493 |
484 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; | 494 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; |
485 if (IsDisabled() || !context_) { | 495 if (IsDisabled() || !context_) { |
486 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); | 496 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); |
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 // Give up the corruption recovery until the browser restarts. | 1448 // Give up the corruption recovery until the browser restarts. |
1439 LOG(ERROR) << "Failed to delete the diskcache."; | 1449 LOG(ERROR) << "Failed to delete the diskcache."; |
1440 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1450 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
1441 return; | 1451 return; |
1442 } | 1452 } |
1443 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1453 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
1444 callback.Run(SERVICE_WORKER_OK); | 1454 callback.Run(SERVICE_WORKER_OK); |
1445 } | 1455 } |
1446 | 1456 |
1447 } // namespace content | 1457 } // namespace content |
OLD | NEW |