| 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_REGISTRATION_HANDLE_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ |
| 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "content/browser/service_worker/service_worker_registration.h" | 11 #include "content/browser/service_worker/service_worker_registration.h" |
| 12 #include "content/browser/service_worker/service_worker_version.h" | 12 #include "content/browser/service_worker/service_worker_version.h" |
| 13 #include "content/common/service_worker/service_worker_types.h" | 13 #include "content/common/service_worker/service_worker_types.h" |
| 14 | 14 |
| 15 namespace content { | 15 namespace content { |
| 16 | 16 |
| 17 class ServiceWorkerContextCore; | 17 class ServiceWorkerContextCore; |
| 18 class ServiceWorkerDispatcherHost; | 18 class ServiceWorkerDispatcherHost; |
| 19 class ServiceWorkerVersion; | 19 class ServiceWorkerVersion; |
| 20 | 20 |
| 21 // Roughly Corresponds to one ServiceWorkerRegistration object in the renderer | 21 // Roughly Corresponds to one ServiceWorkerRegistration object in the renderer |
| 22 // process (WebServiceWorkerRegistrationImpl). | 22 // process (WebServiceWorkerRegistrationImpl). |
| 23 // Has references to the corresponding ServiceWorkerRegistration and | 23 // Has references to the corresponding ServiceWorkerRegistration and |
| 24 // ServiceWorkerVersions (therefore they're guaranteed to be alive while this | 24 // ServiceWorkerVersions (therefore they're guaranteed to be alive while this |
| 25 // handle is around). | 25 // handle is around). |
| 26 class ServiceWorkerRegistrationHandle | 26 class ServiceWorkerRegistrationHandle |
| 27 : public ServiceWorkerRegistration::Listener { | 27 : public ServiceWorkerRegistration::Listener { |
| 28 public: | 28 public: |
| 29 ServiceWorkerRegistrationHandle( | 29 CONTENT_EXPORT ServiceWorkerRegistrationHandle( |
| 30 base::WeakPtr<ServiceWorkerContextCore> context, | 30 base::WeakPtr<ServiceWorkerContextCore> context, |
| 31 ServiceWorkerDispatcherHost* dispatcher_host, | 31 ServiceWorkerDispatcherHost* dispatcher_host, |
| 32 int provider_id, | 32 int provider_id, |
| 33 ServiceWorkerRegistration* registration); | 33 ServiceWorkerRegistration* registration); |
| 34 virtual ~ServiceWorkerRegistrationHandle(); | 34 virtual ~ServiceWorkerRegistrationHandle(); |
| 35 | 35 |
| 36 bool HasNoRefCount() const { return ref_count_ <= 0; } | 36 bool HasNoRefCount() const { return ref_count_ <= 0; } |
| 37 void IncrementRefCount(); | 37 void IncrementRefCount(); |
| 38 void DecrementRefCount(); | 38 void DecrementRefCount(); |
| 39 | 39 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 scoped_refptr<ServiceWorkerVersion> installing_version_; | 74 scoped_refptr<ServiceWorkerVersion> installing_version_; |
| 75 scoped_refptr<ServiceWorkerVersion> waiting_version_; | 75 scoped_refptr<ServiceWorkerVersion> waiting_version_; |
| 76 scoped_refptr<ServiceWorkerVersion> active_version_; | 76 scoped_refptr<ServiceWorkerVersion> active_version_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandle); | 78 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandle); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace content | 81 } // namespace content |
| 82 | 82 |
| 83 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ | 83 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ |
| OLD | NEW |