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

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: 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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 quota_manager_proxy_->NotifyStorageModified(
michaeln 2014/10/08 23:09:16 We'll also have to call NotifyStorageModified for
dmurph 2014/10/11 00:02:26 We don't care about deletions for cache clearing,
michaeln 2014/10/14 00:50:31 I believe we do.
462 storage::QuotaClient::kServiceWorker,
463 registration->pattern().GetOrigin(),
464 storage::StorageType::kStorageTypePersistent,
jsbell 2014/10/08 19:26:41 Persistent->Temporary (again, sorry, my bad)
dmurph 2014/10/11 00:02:26 Done.
465 0);
460 } 466 }
461 467
462 void ServiceWorkerStorage::UpdateToActiveState( 468 void ServiceWorkerStorage::UpdateToActiveState(
463 ServiceWorkerRegistration* registration, 469 ServiceWorkerRegistration* registration,
464 const StatusCallback& callback) { 470 const StatusCallback& callback) {
465 DCHECK(registration); 471 DCHECK(registration);
466 472
467 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_; 473 DCHECK(state_ == INITIALIZED || state_ == DISABLED) << state_;
468 if (IsDisabled() || !context_) { 474 if (IsDisabled() || !context_) {
469 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); 475 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED));
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 // Give up the corruption recovery until the browser restarts. 1426 // Give up the corruption recovery until the browser restarts.
1421 LOG(ERROR) << "Failed to delete the diskcache."; 1427 LOG(ERROR) << "Failed to delete the diskcache.";
1422 callback.Run(SERVICE_WORKER_ERROR_FAILED); 1428 callback.Run(SERVICE_WORKER_ERROR_FAILED);
1423 return; 1429 return;
1424 } 1430 }
1425 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; 1431 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully.";
1426 callback.Run(SERVICE_WORKER_OK); 1432 callback.Run(SERVICE_WORKER_OK);
1427 } 1433 }
1428 1434
1429 } // namespace content 1435 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698