| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_REGISTRATION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 const GURL& script_url, | 38 const GURL& script_url, |
| 39 int64 registration_id); | 39 int64 registration_id); |
| 40 | 40 |
| 41 void Shutdown(); | 41 void Shutdown(); |
| 42 bool is_shutdown() const { return is_shutdown_; } | 42 bool is_shutdown() const { return is_shutdown_; } |
| 43 | 43 |
| 44 int64 id() const { return registration_id_; } | 44 int64 id() const { return registration_id_; } |
| 45 const GURL& script_url() const { return script_url_; } | 45 const GURL& script_url() const { return script_url_; } |
| 46 const GURL& pattern() const { return pattern_; } | 46 const GURL& pattern() const { return pattern_; } |
| 47 | 47 |
| 48 int64 next_version_id() { return next_version_id_++; } | |
| 49 | |
| 50 ServiceWorkerVersion* active_version() const { | 48 ServiceWorkerVersion* active_version() const { |
| 51 DCHECK(!is_shutdown_); | 49 DCHECK(!is_shutdown_); |
| 52 return active_version_.get(); | 50 return active_version_.get(); |
| 53 } | 51 } |
| 54 | 52 |
| 55 ServiceWorkerVersion* pending_version() const { | 53 ServiceWorkerVersion* pending_version() const { |
| 56 DCHECK(!is_shutdown_); | 54 DCHECK(!is_shutdown_); |
| 57 return pending_version_.get(); | 55 return pending_version_.get(); |
| 58 } | 56 } |
| 59 | 57 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 // fired, and the old "active version" is being shut down. | 69 // fired, and the old "active version" is being shut down. |
| 72 void ActivatePendingVersion(); | 70 void ActivatePendingVersion(); |
| 73 | 71 |
| 74 private: | 72 private: |
| 75 ~ServiceWorkerRegistration(); | 73 ~ServiceWorkerRegistration(); |
| 76 friend class base::RefCounted<ServiceWorkerRegistration>; | 74 friend class base::RefCounted<ServiceWorkerRegistration>; |
| 77 | 75 |
| 78 const GURL pattern_; | 76 const GURL pattern_; |
| 79 const GURL script_url_; | 77 const GURL script_url_; |
| 80 const int64 registration_id_; | 78 const int64 registration_id_; |
| 81 int64 next_version_id_; | |
| 82 | 79 |
| 83 scoped_refptr<ServiceWorkerVersion> active_version_; | 80 scoped_refptr<ServiceWorkerVersion> active_version_; |
| 84 scoped_refptr<ServiceWorkerVersion> pending_version_; | 81 scoped_refptr<ServiceWorkerVersion> pending_version_; |
| 85 | 82 |
| 86 bool is_shutdown_; | 83 bool is_shutdown_; |
| 87 | 84 |
| 88 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); | 85 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
| 89 }; | 86 }; |
| 90 } // namespace content | 87 } // namespace content |
| 91 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 88 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
| OLD | NEW |