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

Unified Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 654323003: Revert of 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_context_wrapper.cc
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
index c73909fb130c1519ee03dcb56b5da0f49074fd59..5298a24f7a823fa3f444f8e0969e074d601158d5 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -6,7 +6,6 @@
#include <map>
-#include "base/barrier_closure.h"
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -14,7 +13,6 @@
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_context_observer.h"
#include "content/browser/service_worker/service_worker_process_manager.h"
-#include "content/browser/service_worker/service_worker_quota_client.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "net/url_request/url_request_context_getter.h"
@@ -185,26 +183,35 @@
}
namespace {
-void StatusCodeToBoolCallbackAdapter(
- const ServiceWorkerContext::ResultCallback& callback,
- ServiceWorkerStatusCode code) {
- callback.Run(code == ServiceWorkerStatusCode::SERVICE_WORKER_OK);
-}
void EmptySuccessCallback(bool success) {
}
+
} // namespace
-void ServiceWorkerContextWrapper::DeleteForOrigin(
- const GURL& origin_url,
- const ResultCallback& result) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
- context_core_->UnregisterServiceWorkers(
- origin_url, base::Bind(&StatusCodeToBoolCallbackAdapter, result));
-}
-
void ServiceWorkerContextWrapper::DeleteForOrigin(const GURL& origin_url) {
- DeleteForOrigin(origin_url, base::Bind(&EmptySuccessCallback));
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ context_core_->storage()->GetAllRegistrations(base::Bind(
+ &ServiceWorkerContextWrapper::DidGetAllRegistrationsForDeleteForOrigin,
+ this,
+ origin_url));
+}
+
+void ServiceWorkerContextWrapper::DidGetAllRegistrationsForDeleteForOrigin(
+ const GURL& origin,
+ const std::vector<ServiceWorkerRegistrationInfo>& registrations) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ for (std::vector<ServiceWorkerRegistrationInfo>::const_iterator it =
+ registrations.begin();
+ it != registrations.end();
+ ++it) {
+ const ServiceWorkerRegistrationInfo& registration_info = *it;
+ if (origin == registration_info.pattern.GetOrigin()) {
+ UnregisterServiceWorker(registration_info.pattern,
+ base::Bind(&EmptySuccessCallback));
+ }
+ }
}
void ServiceWorkerContextWrapper::AddObserver(
@@ -249,9 +256,6 @@
return;
}
DCHECK(!context_core_);
- if (quota_manager_proxy) {
- quota_manager_proxy->RegisterClient(new ServiceWorkerQuotaClient(this));
- }
context_core_.reset(new ServiceWorkerContextCore(user_data_directory,
stores_task_runner,
database_task_runner,

Powered by Google App Engine
This is Rietveld 408576698