Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ |
| 7 | 7 |
| 8 namespace content { | 8 namespace content { |
| 9 | 9 |
| 10 // A base class for ServiceWorkerRegisterJob and ServiceWorkerUnregisterJob. A | 10 // A base class for ServiceWorkerRegisterJob and ServiceWorkerUnregisterJob. A |
| 11 // job lives only for the lifetime of a single registration or unregistration. | 11 // job lives only for the lifetime of a single registration or unregistration. |
| 12 class ServiceWorkerRegisterJobBase { | 12 class ServiceWorkerRegisterJobBase { |
| 13 public: | 13 public: |
| 14 enum RegistrationJobType { REGISTRATION, UNREGISTRATION, }; | 14 enum RegistrationJobType { REGISTRATION, UNREGISTRATION, UPDATE_JOB }; |
|
falken
2014/07/10 03:45:32
bikeshed nit: "UPDATE" seems more consistent with
michaeln
2014/07/14 23:02:30
it does, but that collides with the Phase enum als
| |
| 15 | 15 |
| 16 virtual ~ServiceWorkerRegisterJobBase() {} | 16 virtual ~ServiceWorkerRegisterJobBase() {} |
| 17 | 17 |
| 18 // Starts the job. This method should be called once and only once per job. | 18 // Starts the job. This method should be called once and only once per job. |
| 19 virtual void Start() = 0; | 19 virtual void Start() = 0; |
| 20 | 20 |
| 21 // Aborts the job. This method should be called once and only once per job. | 21 // Aborts the job. This method should be called once and only once per job. |
| 22 // It can be called regardless of whether Start() was called. | 22 // It can be called regardless of whether Start() was called. |
| 23 virtual void Abort() = 0; | 23 virtual void Abort() = 0; |
| 24 | 24 |
| 25 // Returns true if this job is identical to |job| for the purpose of | 25 // Returns true if this job is identical to |job| for the purpose of |
| 26 // collapsing them together in a ServiceWorkerJobCoordinator queue. | 26 // collapsing them together in a ServiceWorkerJobCoordinator queue. |
| 27 // Registration jobs are equal if they are for the same pattern and script | 27 // Registration jobs are equal if they are for the same pattern and script |
| 28 // URL; unregistration jobs are equal if they are for the same pattern. | 28 // URL; unregistration jobs are equal if they are for the same pattern. |
| 29 virtual bool Equals(ServiceWorkerRegisterJobBase* job) = 0; | 29 virtual bool Equals(ServiceWorkerRegisterJobBase* job) = 0; |
| 30 | 30 |
| 31 // Returns the type of this job. | 31 // Returns the type of this job. |
| 32 virtual RegistrationJobType GetType() = 0; | 32 virtual RegistrationJobType GetType() = 0; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace content | 35 } // namespace content |
| 36 | 36 |
| 37 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ | 37 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTER_JOB_BASE_H_ |
| OLD | NEW |