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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // the request doesn't require special handling. | 108 // the request doesn't require special handling. |
109 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( | 109 scoped_ptr<ServiceWorkerRequestHandler> CreateRequestHandler( |
110 FetchRequestMode request_mode, | 110 FetchRequestMode request_mode, |
111 FetchCredentialsMode credentials_mode, | 111 FetchCredentialsMode credentials_mode, |
112 ResourceType resource_type, | 112 ResourceType resource_type, |
113 RequestContextType request_context_type, | 113 RequestContextType request_context_type, |
114 RequestContextFrameType frame_type, | 114 RequestContextFrameType frame_type, |
115 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 115 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
116 scoped_refptr<ResourceRequestBody> body); | 116 scoped_refptr<ResourceRequestBody> body); |
117 | 117 |
| 118 // Creates a ServiceWorkerHandle to retain |version| and returns a |
| 119 // ServiceWorkerInfo with a newly created handle ID. The handle is held in |
| 120 // the dispatcher host until its ref-count becomes zero. |
| 121 ServiceWorkerObjectInfo CreateAndRegisterServiceWorkerHandle( |
| 122 ServiceWorkerVersion* version); |
| 123 |
118 // Returns true if |registration| can be associated with this provider. | 124 // Returns true if |registration| can be associated with this provider. |
119 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); | 125 bool CanAssociateRegistration(ServiceWorkerRegistration* registration); |
120 | 126 |
121 // For use by the ServiceWorkerControlleeRequestHandler to disallow | 127 // For use by the ServiceWorkerControlleeRequestHandler to disallow |
122 // new registration association while a navigation is occurring and | 128 // new registration association while a navigation is occurring and |
123 // an existing registration is being looked for. | 129 // an existing registration is being looked for. |
124 void SetAllowAssociation(bool allow) { allow_association_ = allow; } | 130 void SetAllowAssociation(bool allow) { allow_association_ = allow; } |
125 | 131 |
126 // Returns true if the context referred to by this host (i.e. |context_|) is | 132 // Returns true if the context referred to by this host (i.e. |context_|) is |
127 // still alive. | 133 // still alive. |
(...skipping 20 matching lines...) Expand all Loading... |
148 void PrepareForCrossSiteTransfer(); | 154 void PrepareForCrossSiteTransfer(); |
149 void CompleteCrossSiteTransfer( | 155 void CompleteCrossSiteTransfer( |
150 int new_process_id, | 156 int new_process_id, |
151 int new_frame_id, | 157 int new_frame_id, |
152 int new_provider_id, | 158 int new_provider_id, |
153 ServiceWorkerDispatcherHost* dispatcher_host); | 159 ServiceWorkerDispatcherHost* dispatcher_host); |
154 ServiceWorkerDispatcherHost* dispatcher_host() const { | 160 ServiceWorkerDispatcherHost* dispatcher_host() const { |
155 return dispatcher_host_; | 161 return dispatcher_host_; |
156 } | 162 } |
157 | 163 |
| 164 // Called from ServiceWorkerRegistrationHandle. |
| 165 void SendUpdateFoundMessage( |
| 166 const ServiceWorkerRegistrationObjectInfo& object_info); |
| 167 void SendSetVersionAttributesMessage( |
| 168 int registration_handle_id, |
| 169 ChangedVersionAttributesMask changed_mask, |
| 170 ServiceWorkerVersion* installing_version, |
| 171 ServiceWorkerVersion* waiting_version, |
| 172 ServiceWorkerVersion* active_version); |
| 173 |
| 174 // Called from ServiceWorkerHandle. |
| 175 void SendServiceWorkerStateChangedMessage( |
| 176 int worker_handle_id, |
| 177 blink::WebServiceWorkerState state); |
| 178 |
158 private: | 179 private: |
159 friend class ServiceWorkerProviderHostTest; | 180 friend class ServiceWorkerProviderHostTest; |
160 friend class ServiceWorkerWriteToCacheJobTest; | 181 friend class ServiceWorkerWriteToCacheJobTest; |
161 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 182 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
162 UpdateBefore24Hours); | 183 UpdateBefore24Hours); |
163 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, | 184 FRIEND_TEST_ALL_PREFIXES(ServiceWorkerContextRequestHandlerTest, |
164 UpdateAfter24Hours); | 185 UpdateAfter24Hours); |
165 | 186 |
166 // ServiceWorkerRegistration::Listener overrides. | 187 // ServiceWorkerRegistration::Listener overrides. |
167 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; | 188 void OnRegistrationFailed(ServiceWorkerRegistration* registration) override; |
(...skipping 23 matching lines...) Expand all Loading... |
191 base::WeakPtr<ServiceWorkerContextCore> context_; | 212 base::WeakPtr<ServiceWorkerContextCore> context_; |
192 ServiceWorkerDispatcherHost* dispatcher_host_; | 213 ServiceWorkerDispatcherHost* dispatcher_host_; |
193 bool allow_association_; | 214 bool allow_association_; |
194 | 215 |
195 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 216 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
196 }; | 217 }; |
197 | 218 |
198 } // namespace content | 219 } // namespace content |
199 | 220 |
200 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 221 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
OLD | NEW |