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 30 matching lines...) Expand all Loading... |
41 void IncrementRefCount(); | 41 void IncrementRefCount(); |
42 void DecrementRefCount(); | 42 void DecrementRefCount(); |
43 | 43 |
44 int provider_id() const { return provider_id_; } | 44 int provider_id() const { return provider_id_; } |
45 int handle_id() const { return handle_id_; } | 45 int handle_id() const { return handle_id_; } |
46 | 46 |
47 ServiceWorkerRegistration* registration() { return registration_.get(); } | 47 ServiceWorkerRegistration* registration() { return registration_.get(); } |
48 | 48 |
49 private: | 49 private: |
50 // ServiceWorkerRegistration::Listener overrides. | 50 // ServiceWorkerRegistration::Listener overrides. |
51 virtual void OnVersionAttributesChanged( | 51 void OnVersionAttributesChanged( |
52 ServiceWorkerRegistration* registration, | 52 ServiceWorkerRegistration* registration, |
53 ChangedVersionAttributesMask changed_mask, | 53 ChangedVersionAttributesMask changed_mask, |
54 const ServiceWorkerRegistrationInfo& info) override; | 54 const ServiceWorkerRegistrationInfo& info) override; |
55 virtual void OnRegistrationFailed( | 55 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; |
56 ServiceWorkerRegistration* registration) override; | 56 void OnUpdateFound(ServiceWorkerRegistration* registration) override; |
57 virtual void OnUpdateFound( | |
58 ServiceWorkerRegistration* registration) override; | |
59 | 57 |
60 // Sets the corresponding version field to the given version or if the given | 58 // Sets the corresponding version field to the given version or if the given |
61 // version is NULL, clears the field. | 59 // version is NULL, clears the field. |
62 void SetVersionAttributes( | 60 void SetVersionAttributes( |
63 ServiceWorkerVersion* installing_version, | 61 ServiceWorkerVersion* installing_version, |
64 ServiceWorkerVersion* waiting_version, | 62 ServiceWorkerVersion* waiting_version, |
65 ServiceWorkerVersion* active_version); | 63 ServiceWorkerVersion* active_version); |
66 | 64 |
67 // Clears all version fields. | 65 // Clears all version fields. |
68 void ClearVersionAttributes(); | 66 void ClearVersionAttributes(); |
69 | 67 |
70 base::WeakPtr<ServiceWorkerContextCore> context_; | 68 base::WeakPtr<ServiceWorkerContextCore> context_; |
71 ServiceWorkerDispatcherHost* dispatcher_host_; | 69 ServiceWorkerDispatcherHost* dispatcher_host_; |
72 const int provider_id_; | 70 const int provider_id_; |
73 const int handle_id_; | 71 const int handle_id_; |
74 int ref_count_; // Created with 1. | 72 int ref_count_; // Created with 1. |
75 | 73 |
76 scoped_refptr<ServiceWorkerRegistration> registration_; | 74 scoped_refptr<ServiceWorkerRegistration> registration_; |
77 scoped_refptr<ServiceWorkerVersion> installing_version_; | 75 scoped_refptr<ServiceWorkerVersion> installing_version_; |
78 scoped_refptr<ServiceWorkerVersion> waiting_version_; | 76 scoped_refptr<ServiceWorkerVersion> waiting_version_; |
79 scoped_refptr<ServiceWorkerVersion> active_version_; | 77 scoped_refptr<ServiceWorkerVersion> active_version_; |
80 | 78 |
81 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandle); | 79 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistrationHandle); |
82 }; | 80 }; |
83 | 81 |
84 } // namespace content | 82 } // namespace content |
85 | 83 |
86 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ | 84 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_HANDLE_H_ |
OLD | NEW |