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

Unified Diff: content/browser/service_worker/service_worker_register_job.h

Issue 229403004: Assert about ServiceWorkerRegisterJob internal state in terms of phases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more assert Created 6 years, 8 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_register_job.h
diff --git a/content/browser/service_worker/service_worker_register_job.h b/content/browser/service_worker/service_worker_register_job.h
index 46aa9c89dbc05ae48ee815e6027cc9eb42154613..fbe02288a2e5a5d9585d392e814714301ad72476 100644
--- a/content/browser/service_worker/service_worker_register_job.h
+++ b/content/browser/service_worker/service_worker_register_job.h
@@ -54,6 +54,29 @@ class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase {
virtual RegistrationJobType GetType() OVERRIDE;
private:
+ enum Phase {
+ INITIAL,
+ START,
+ REGISTER,
+ UPDATE,
+ INSTALL,
+ ACTIVATE,
+ COMPLETE
+ };
+
+ struct ServiceWorkerRegisterJobInternal {
+ ServiceWorkerRegisterJobInternal()
+ : registration_(NULL), pending_version_(NULL) {}
+
+ scoped_refptr<ServiceWorkerRegistration> registration_;
+ scoped_refptr<ServiceWorkerVersion> pending_version_;
+ };
+
+ void set_registration(ServiceWorkerRegistration* registration);
+ ServiceWorkerRegistration* registration();
+ void set_pending_version(ServiceWorkerVersion* version);
+ ServiceWorkerVersion* pending_version();
+
void HandleExistingRegistrationAndContinue(
ServiceWorkerStatusCode status,
const scoped_refptr<ServiceWorkerRegistration>& registration);
@@ -68,14 +91,15 @@ class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase {
void RunCallbacks(ServiceWorkerStatusCode status,
ServiceWorkerVersion* version);
- // The ServiceWorkerStorage object should always outlive this.
+ // The ServiceWorkerContextCore object should always outlive this.
base::WeakPtr<ServiceWorkerContextCore> context_;
- scoped_refptr<ServiceWorkerRegistration> registration_;
- scoped_refptr<ServiceWorkerVersion> pending_version_;
+
const GURL pattern_;
const GURL script_url_;
std::vector<RegistrationCallback> callbacks_;
std::vector<int> pending_process_ids_;
+ Phase phase_;
+ ServiceWorkerRegisterJobInternal internal_;
base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob);

Powered by Google App Engine
This is Rietveld 408576698