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

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: fix ctor/dtor style error and bad merge 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_register_job.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6e07c66f494cf3976d116868724a9d6eddce951f..bd65f69697b3f8aae6210546837169d8b94f280d 100644
--- a/content/browser/service_worker/service_worker_register_job.h
+++ b/content/browser/service_worker/service_worker_register_job.h
@@ -55,6 +55,32 @@ class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase {
virtual RegistrationJobType GetType() OVERRIDE;
private:
+ enum Phase {
+ INITIAL,
+ START,
+ REGISTER,
+ UPDATE,
+ INSTALL,
+ ACTIVATE,
+ COMPLETE
+ };
+
+ // Holds internal state of ServiceWorkerRegistrationJob, to compel use of the
+ // getter/setter functions.
+ struct Internal {
+ Internal();
+ ~Internal();
+ 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 SetPhase(Phase phase);
+
void HandleExistingRegistrationAndContinue(
ServiceWorkerStatusCode status,
const scoped_refptr<ServiceWorkerRegistration>& registration);
@@ -70,14 +96,15 @@ class ServiceWorkerRegisterJob : public ServiceWorkerRegisterJobBase {
ServiceWorkerRegistration* registration,
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_;
+ Internal internal_;
base::WeakPtrFactory<ServiceWorkerRegisterJob> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegisterJob);
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_register_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698