| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 ServiceWorkerRegistration* associated_registration() const { | 128 ServiceWorkerRegistration* associated_registration() const { |
| 129 return associated_registration_.get(); | 129 return associated_registration_.get(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // The running version, if any, that this provider is providing resource | 132 // The running version, if any, that this provider is providing resource |
| 133 // loads for. | 133 // loads for. |
| 134 ServiceWorkerVersion* running_hosted_version() const { | 134 ServiceWorkerVersion* running_hosted_version() const { |
| 135 return running_hosted_version_.get(); | 135 return running_hosted_version_.get(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Sets the |document_url_|. When this object is for a client, |
| 139 // |matching_registrations_| gets also updated to ensure that |document_url_| |
| 140 // is in scope of all |matching_registrations_|. |
| 138 void SetDocumentUrl(const GURL& url); | 141 void SetDocumentUrl(const GURL& url); |
| 139 const GURL& document_url() const { return document_url_; } | 142 const GURL& document_url() const { return document_url_; } |
| 140 | 143 |
| 141 void SetTopmostFrameUrl(const GURL& url); | 144 void SetTopmostFrameUrl(const GURL& url); |
| 142 const GURL& topmost_frame_url() const { return topmost_frame_url_; } | 145 const GURL& topmost_frame_url() const { return topmost_frame_url_; } |
| 143 | 146 |
| 144 ServiceWorkerProviderType provider_type() const { return provider_type_; } | 147 ServiceWorkerProviderType provider_type() const { return provider_type_; } |
| 145 bool IsProviderForClient() const; | 148 bool IsProviderForClient() const; |
| 146 blink::WebServiceWorkerClientType client_type() const; | 149 blink::WebServiceWorkerClientType client_type() const; |
| 147 | 150 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 void SendServiceWorkerStateChangedMessage( | 240 void SendServiceWorkerStateChangedMessage( |
| 238 int worker_handle_id, | 241 int worker_handle_id, |
| 239 blink::WebServiceWorkerState state); | 242 blink::WebServiceWorkerState state); |
| 240 | 243 |
| 241 // Sets the worker thread id and flushes queued events. | 244 // Sets the worker thread id and flushes queued events. |
| 242 void SetReadyToSendMessagesToWorker(int render_thread_id); | 245 void SetReadyToSendMessagesToWorker(int render_thread_id); |
| 243 | 246 |
| 244 void AddMatchingRegistration(ServiceWorkerRegistration* registration); | 247 void AddMatchingRegistration(ServiceWorkerRegistration* registration); |
| 245 void RemoveMatchingRegistration(ServiceWorkerRegistration* registration); | 248 void RemoveMatchingRegistration(ServiceWorkerRegistration* registration); |
| 246 | 249 |
| 247 // Add matched registrations for document generated by shift-reload. | |
| 248 void AddAllMatchingRegistrations(); | |
| 249 | |
| 250 // An optimized implementation of [[Match Service Worker Registration]] | 250 // An optimized implementation of [[Match Service Worker Registration]] |
| 251 // for current document. | 251 // for current document. |
| 252 ServiceWorkerRegistration* MatchRegistration() const; | 252 ServiceWorkerRegistration* MatchRegistration() const; |
| 253 | 253 |
| 254 // Called when our controller has been terminated and doomed due to an | 254 // Called when our controller has been terminated and doomed due to an |
| 255 // exceptional condition like it could no longer be read from the script | 255 // exceptional condition like it could no longer be read from the script |
| 256 // cache. | 256 // cache. |
| 257 void NotifyControllerLost(); | 257 void NotifyControllerLost(); |
| 258 | 258 |
| 259 private: | 259 private: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 void OnSkippedWaiting(ServiceWorkerRegistration* registration) override; | 302 void OnSkippedWaiting(ServiceWorkerRegistration* registration) override; |
| 303 | 303 |
| 304 // Sets the controller version field to |version| or if |version| is NULL, | 304 // Sets the controller version field to |version| or if |version| is NULL, |
| 305 // clears the field. If |notify_controllerchange| is true, instructs the | 305 // clears the field. If |notify_controllerchange| is true, instructs the |
| 306 // renderer to dispatch a 'controller' change event. | 306 // renderer to dispatch a 'controller' change event. |
| 307 void SetControllerVersionAttribute(ServiceWorkerVersion* version, | 307 void SetControllerVersionAttribute(ServiceWorkerVersion* version, |
| 308 bool notify_controllerchange); | 308 bool notify_controllerchange); |
| 309 | 309 |
| 310 void SendAssociateRegistrationMessage(); | 310 void SendAssociateRegistrationMessage(); |
| 311 | 311 |
| 312 // Syncs matching registrations with live registrations. |
| 313 void SyncMatchingRegistrations(); |
| 314 |
| 315 // Discards all references to matching registrations. |
| 316 void RemoveAllMatchingRegistrations(); |
| 317 |
| 312 // Increase/decrease this host's process reference for |pattern|. | 318 // Increase/decrease this host's process reference for |pattern|. |
| 313 void IncreaseProcessReference(const GURL& pattern); | 319 void IncreaseProcessReference(const GURL& pattern); |
| 314 void DecreaseProcessReference(const GURL& pattern); | 320 void DecreaseProcessReference(const GURL& pattern); |
| 315 | 321 |
| 316 void ReturnRegistrationForReadyIfNeeded(); | 322 void ReturnRegistrationForReadyIfNeeded(); |
| 317 | 323 |
| 318 bool IsReadyToSendMessages() const; | 324 bool IsReadyToSendMessages() const; |
| 319 void Send(IPC::Message* message) const; | 325 void Send(IPC::Message* message) const; |
| 320 | 326 |
| 321 // Finalizes cross-site transfers and navigation-initalized hosts. | 327 // Finalizes cross-site transfers and navigation-initalized hosts. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 352 bool allow_association_; | 358 bool allow_association_; |
| 353 | 359 |
| 354 std::vector<base::Closure> queued_events_; | 360 std::vector<base::Closure> queued_events_; |
| 355 | 361 |
| 356 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); | 362 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerProviderHost); |
| 357 }; | 363 }; |
| 358 | 364 |
| 359 } // namespace content | 365 } // namespace content |
| 360 | 366 |
| 361 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ | 367 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_PROVIDER_HOST_H_ |
| OLD | NEW |