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

Unified Diff: content/browser/service_worker/service_worker_storage.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_storage.cc
diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc
index 16a671e20b8a929b45d29f5a925e826af96cd062..17e3f01d7d38b37472b6f7fcbabb93a652a7a715 100644
--- a/content/browser/service_worker/service_worker_storage.cc
+++ b/content/browser/service_worker/service_worker_storage.cc
@@ -7,7 +7,6 @@
#include <string>
#include "base/strings/string_util.h"
-#include "content/browser/service_worker/service_worker_register_job.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/public/browser/browser_thread.h"
#include "webkit/browser/quota/quota_manager.h"
@@ -95,29 +94,6 @@ void ServiceWorkerStorage::FindRegistrationForDocument(
scoped_refptr<ServiceWorkerRegistration>()));
}
-void ServiceWorkerStorage::Register(const GURL& pattern,
- const GURL& script_url,
- const RegistrationCallback& callback) {
- scoped_ptr<ServiceWorkerRegisterJob> job(new ServiceWorkerRegisterJob(
- weak_factory_.GetWeakPtr(),
- base::Bind(&ServiceWorkerStorage::RegisterComplete,
- weak_factory_.GetWeakPtr(),
- callback)));
- job->StartRegister(pattern, script_url);
- registration_jobs_.push_back(job.release());
-}
-
-void ServiceWorkerStorage::Unregister(const GURL& pattern,
- const UnregistrationCallback& callback) {
- scoped_ptr<ServiceWorkerRegisterJob> job(new ServiceWorkerRegisterJob(
- weak_factory_.GetWeakPtr(),
- base::Bind(&ServiceWorkerStorage::UnregisterComplete,
- weak_factory_.GetWeakPtr(),
- callback)));
- job->StartUnregister(pattern);
- registration_jobs_.push_back(job.release());
-}
-
scoped_refptr<ServiceWorkerRegistration> ServiceWorkerStorage::RegisterInternal(
const GURL& pattern,
const GURL& script_url) {
@@ -161,34 +137,4 @@ bool ServiceWorkerStorage::PatternMatches(const GURL& pattern,
return MatchPattern(url.spec(), pattern_spec);
}
-void ServiceWorkerStorage::EraseJob(ServiceWorkerRegisterJob* job) {
- ScopedVector<ServiceWorkerRegisterJob>::iterator job_position =
- registration_jobs_.begin();
- for (; job_position != registration_jobs_.end(); ++job_position) {
- if (*job_position == job) {
- registration_jobs_.erase(job_position);
- return;
- }
- }
- NOTREACHED() << "Deleting non-existent job. ";
-}
-
-void ServiceWorkerStorage::UnregisterComplete(
- const UnregistrationCallback& callback,
- ServiceWorkerRegisterJob* job,
- ServiceWorkerRegistrationStatus status,
- ServiceWorkerRegistration* previous_registration) {
- callback.Run(status);
- EraseJob(job);
-}
-
-void ServiceWorkerStorage::RegisterComplete(
- const RegistrationCallback& callback,
- ServiceWorkerRegisterJob* job,
- ServiceWorkerRegistrationStatus status,
- ServiceWorkerRegistration* registration) {
- callback.Run(status, registration);
- EraseJob(job);
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698