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" |
(...skipping 10 matching lines...) Expand all Loading... |
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 CONTENT_EXPORT ServiceWorkerRegistrationHandle( | 29 CONTENT_EXPORT ServiceWorkerRegistrationHandle( |
30 base::WeakPtr<ServiceWorkerContextCore> context, | 30 base::WeakPtr<ServiceWorkerContextCore> context, |
31 ServiceWorkerDispatcherHost* dispatcher_host, | 31 base::WeakPtr<ServiceWorkerProviderHost> provider_host, |
32 int provider_id, | |
33 ServiceWorkerRegistration* registration); | 32 ServiceWorkerRegistration* registration); |
34 virtual ~ServiceWorkerRegistrationHandle(); | 33 virtual ~ServiceWorkerRegistrationHandle(); |
35 | 34 |
36 ServiceWorkerRegistrationObjectInfo GetObjectInfo(); | 35 ServiceWorkerRegistrationObjectInfo GetObjectInfo(); |
37 | 36 |
38 bool HasNoRefCount() const { return ref_count_ <= 0; } | 37 bool HasNoRefCount() const { return ref_count_ <= 0; } |
39 void IncrementRefCount(); | 38 void IncrementRefCount(); |
40 void DecrementRefCount(); | 39 void DecrementRefCount(); |
41 | 40 |
42 int provider_id() const { return provider_id_; } | 41 int provider_id() const { return provider_id_; } |
(...skipping 12 matching lines...) Expand all Loading... |
55 | 54 |
56 // Sets the corresponding version field to the given version or if the given | 55 // Sets the corresponding version field to the given version or if the given |
57 // version is nullptr, clears the field. | 56 // version is nullptr, clears the field. |
58 void SetVersionAttributes( | 57 void SetVersionAttributes( |
59 ChangedVersionAttributesMask changed_mask, | 58 ChangedVersionAttributesMask changed_mask, |
60 ServiceWorkerVersion* installing_version, | 59 ServiceWorkerVersion* installing_version, |
61 ServiceWorkerVersion* waiting_version, | 60 ServiceWorkerVersion* waiting_version, |
62 ServiceWorkerVersion* active_version); | 61 ServiceWorkerVersion* active_version); |
63 | 62 |
64 base::WeakPtr<ServiceWorkerContextCore> context_; | 63 base::WeakPtr<ServiceWorkerContextCore> context_; |
65 ServiceWorkerDispatcherHost* dispatcher_host_; | 64 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; |
66 const int provider_id_; | 65 const int provider_id_; |
67 const int handle_id_; | 66 const int handle_id_; |
68 int ref_count_; // Created with 1. | 67 int ref_count_; // Created with 1. |
69 | 68 |
70 scoped_refptr<ServiceWorkerRegistration> registration_; | 69 scoped_refptr<ServiceWorkerRegistration> registration_; |
71 | 70 |
72 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandle); | 71 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandle); |
73 }; | 72 }; |
74 | 73 |
75 } // namespace content | 74 } // namespace content |
76 | 75 |
77 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ | 76 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ |
OLD | NEW |