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

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

Issue 113133013: Refactor job coordination into a separate class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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_core.cc
diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc
index 048d33bd836da9455bdc8fef0456b1b2cd16c341..ef5927739fc6edf41b63e61f15260451bc259c70 100644
--- a/content/browser/service_worker/service_worker_context_core.cc
+++ b/content/browser/service_worker/service_worker_context_core.cc
@@ -22,6 +22,7 @@ ServiceWorkerContextCore::ServiceWorkerContextCore(
const base::FilePath& path,
quota::QuotaManagerProxy* quota_manager_proxy)
: storage_(new ServiceWorkerStorage(path, quota_manager_proxy)),
+ job_coordinator_(new ServiceWorkerJobCoordinator(storage_->AsWeakPtr())),
kinuko 2013/12/18 05:43:35 I think probably this should take ContextCore's we
alecflett 2014/01/06 21:47:12 My interest here is more around encapsulation and
kinuko 2014/01/08 06:19:10 I rather think that we can always create a small C
embedded_worker_registry_(new EmbeddedWorkerRegistry(AsWeakPtr())) {}
ServiceWorkerContextCore::~ServiceWorkerContextCore() {}
@@ -69,11 +70,12 @@ void ServiceWorkerContextCore::RegisterServiceWorker(
const RegistrationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- storage_->Register(pattern,
- script_url,
- base::Bind(&ServiceWorkerContextCore::RegistrationComplete,
- AsWeakPtr(),
- callback));
+ job_coordinator_->Register(
+ pattern,
+ script_url,
+ base::Bind(&ServiceWorkerContextCore::RegistrationComplete,
+ AsWeakPtr(),
+ callback));
}
void ServiceWorkerContextCore::UnregisterServiceWorker(
@@ -81,7 +83,7 @@ void ServiceWorkerContextCore::UnregisterServiceWorker(
const UnregistrationCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- storage_->Unregister(pattern, callback);
+ job_coordinator_->Unregister(pattern, callback);
}
void ServiceWorkerContextCore::RegistrationComplete(

Powered by Google App Engine
This is Rietveld 408576698