Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: content/browser/service_worker/service_worker_storage.cc

Issue 633273002: Added quota client for serviceworker. Enables 'clear past <time> data'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 FROM_HERE, 472 FROM_HERE,
473 base::Bind(&WriteRegistrationInDB, 473 base::Bind(&WriteRegistrationInDB,
474 database_.get(), 474 database_.get(),
475 base::MessageLoopProxy::current(), 475 base::MessageLoopProxy::current(),
476 data, resources, 476 data, resources,
477 base::Bind(&ServiceWorkerStorage::DidStoreRegistration, 477 base::Bind(&ServiceWorkerStorage::DidStoreRegistration,
478 weak_factory_.GetWeakPtr(), 478 weak_factory_.GetWeakPtr(),
479 callback))); 479 callback)));
480 480
481 registration->set_is_deleted(false); 481 registration->set_is_deleted(false);
482
483 // TODO(dmurph): Add correct byte delta.
484 if (quota_manager_proxy_.get()) {
485 // Can be nullptr in tests.
486 quota_manager_proxy_->NotifyStorageModified(
487 storage::QuotaClient::kServiceWorker,
488 registration->pattern().GetOrigin(),
489 storage::StorageType::kStorageTypeTemporary,
490 0);
491 }
482 } 492 }
483 493
484 void ServiceWorkerStorage::UpdateToActiveState( 494 void ServiceWorkerStorage::UpdateToActiveState(
485 ServiceWorkerRegistration* registration, 495 ServiceWorkerRegistration* registration,
486 const StatusCallback& callback) { 496 const StatusCallback& callback) {
487 DCHECK(registration); 497 DCHECK(registration);
488 498
489 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; 499 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_;
490 if (IsDisabled() || !context_) { 500 if (IsDisabled() || !context_) {
491 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); 501 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED));
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 // Give up the corruption recovery until the browser restarts. 1489 // Give up the corruption recovery until the browser restarts.
1480 LOG(ERROR) << "Failed to delete the diskcache."; 1490 LOG(ERROR) << "Failed to delete the diskcache.";
1481 callback.Run(SERVICE_WORKER_ERROR_FAILED); 1491 callback.Run(SERVICE_WORKER_ERROR_FAILED);
1482 return; 1492 return;
1483 } 1493 }
1484 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; 1494 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully.";
1485 callback.Run(SERVICE_WORKER_OK); 1495 callback.Run(SERVICE_WORKER_OK);
1486 } 1496 }
1487 1497
1488 } // namespace content 1498 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_quota_client.cc ('k') | content/browser/storage_partition_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698