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_PROVIDER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 | 78 |
79 void SetDocumentUrl(const GURL& url); | 79 void SetDocumentUrl(const GURL& url); |
80 const GURL& document_url() const { return document_url_; } | 80 const GURL& document_url() const { return document_url_; } |
81 | 81 |
82 // Associates to |registration| to listen for its version change events. | 82 // Associates to |registration| to listen for its version change events. |
83 void AssociateRegistration(ServiceWorkerRegistration* registration); | 83 void AssociateRegistration(ServiceWorkerRegistration* registration); |
84 | 84 |
85 // Clears the associated registration and stop listening to it. | 85 // Clears the associated registration and stop listening to it. |
86 void UnassociateRegistration(); | 86 void UnassociateRegistration(); |
87 | 87 |
88 // Associates to |registration| then this provider can provide running | |
dominicc (has gone to gerrit)
2014/09/03 17:49:59
This comment needs work.
xiang
2014/09/04 09:18:36
Done.
| |
89 // process for it. These registrations will be released in destructor. | |
90 void AssociatePendingRegistration(ServiceWorkerRegistration* registration); | |
91 | |
88 // Returns false if the version is not in the expected STARTING in our | 92 // Returns false if the version is not in the expected STARTING in our |
89 // process state. That would be indicative of a bad IPC message. | 93 // process state. That would be indicative of a bad IPC message. |
90 bool SetHostedVersionId(int64 versions_id); | 94 bool SetHostedVersionId(int64 versions_id); |
91 | 95 |
92 // Returns a handler for a request, the handler may return NULL if | 96 // Returns a handler for a request, the handler may return NULL if |
93 // the request doesn't require special handling. | 97 // the request doesn't require special handling. |
94 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( | 98 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( |
95 ResourceType resource_type, | 99 ResourceType resource_type, |
96 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 100 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
97 scoped_refptr<ResourceRequestBody> body); | 101 scoped_refptr<ResourceRequestBody> body); |
(...skipping 17 matching lines...) Expand all Loading... | |
115 UpdateAfter24Hours); | 119 UpdateAfter24Hours); |
116 | 120 |
117 // ServiceWorkerRegistration::Listener overrides. | 121 // ServiceWorkerRegistration::Listener overrides. |
118 virtual void OnVersionAttributesChanged( | 122 virtual void OnVersionAttributesChanged( |
119 ServiceWorkerRegistration* registration, | 123 ServiceWorkerRegistration* registration, |
120 ChangedVersionAttributesMask changed_mask, | 124 ChangedVersionAttributesMask changed_mask, |
121 const ServiceWorkerRegistrationInfo& info) OVERRIDE; | 125 const ServiceWorkerRegistrationInfo& info) OVERRIDE; |
122 virtual void OnRegistrationFailed( | 126 virtual void OnRegistrationFailed( |
123 ServiceWorkerRegistration* registration) OVERRIDE; | 127 ServiceWorkerRegistration* registration) OVERRIDE; |
124 | 128 |
125 // Adds this provider host to the potential controllee list of the given | |
126 // versions and removes it from the previous versions. | |
127 void UpdatePotentialControllees( | |
128 ServiceWorkerVersion* installing_version, | |
129 ServiceWorkerVersion* waiting_version, | |
130 ServiceWorkerVersion* active_version); | |
131 | |
132 // Sets the controller version field to |version| or if |version| is NULL, | 129 // Sets the controller version field to |version| or if |version| is NULL, |
133 // clears the field. | 130 // clears the field. |
134 void SetControllerVersionAttribute(ServiceWorkerVersion* version); | 131 void SetControllerVersionAttribute(ServiceWorkerVersion* version); |
135 | 132 |
136 // Creates a ServiceWorkerHandle to retain |version| and returns a | 133 // Creates a ServiceWorkerHandle to retain |version| and returns a |
137 // ServiceWorkerInfo with the handle ID to pass to the provider. The | 134 // ServiceWorkerInfo with the handle ID to pass to the provider. The |
138 // provider is responsible for releasing the handle. | 135 // provider is responsible for releasing the handle. |
139 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version); | 136 ServiceWorkerObjectInfo CreateHandleAndPass(ServiceWorkerVersion* version); |
140 | 137 |
138 // Increase/Decrease corresponding process reference for process manager. | |
139 void IncreaseProcessReference(ServiceWorkerRegistration* registration); | |
140 void DecreaseProcessReference(ServiceWorkerRegistration* registration); | |
141 | |
141 const int process_id_; | 142 const int process_id_; |
142 const int provider_id_; | 143 const int provider_id_; |
143 GURL document_url_; | 144 GURL document_url_; |
144 | 145 |
145 scoped_refptr<ServiceWorkerRegistration> associated_registration_; | 146 scoped_refptr<ServiceWorkerRegistration> associated_registration_; |
147 std::vector<scoped_refptr<ServiceWorkerRegistration> > pending_registrations_; | |
michaeln
2014/09/04 01:26:32
can this be a collection of GURL patterns so this
xiang
2014/09/04 09:18:36
Done.
| |
146 | 148 |
147 scoped_refptr<ServiceWorkerVersion> controlling_version_; | 149 scoped_refptr<ServiceWorkerVersion> controlling_version_; |
148 scoped_refptr<ServiceWorkerVersion> active_version_; | 150 scoped_refptr<ServiceWorkerVersion> active_version_; |
149 scoped_refptr<ServiceWorkerVersion> waiting_version_; | 151 scoped_refptr<ServiceWorkerVersion> waiting_version_; |
150 scoped_refptr<ServiceWorkerVersion> installing_version_; | 152 scoped_refptr<ServiceWorkerVersion> installing_version_; |
151 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; | 153 scoped_refptr<ServiceWorkerVersion> running_hosted_version_; |
152 base::WeakPtr<ServiceWorkerContextCore> context_; | 154 base::WeakPtr<ServiceWorkerContextCore> context_; |
153 ServiceWorkerDispatcherHost* dispatcher_host_; | 155 ServiceWorkerDispatcherHost* dispatcher_host_; |
154 | 156 |
155 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 157 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
156 }; | 158 }; |
157 | 159 |
158 } // namespace content | 160 } // namespace content |
159 | 161 |
160 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 162 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |