Chromium Code Reviews| 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 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "content/browser/message_port_message_filter.h" | 10 #include "content/browser/message_port_message_filter.h" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 BadMessageReceived(); | 554 BadMessageReceived(); |
| 555 | 555 |
| 556 // Retrieve the registration associated with |version_id|. | 556 // Retrieve the registration associated with |version_id|. |
| 557 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); | 557 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); |
| 558 if (!version) | 558 if (!version) |
| 559 return; | 559 return; |
| 560 ServiceWorkerRegistration* registration = | 560 ServiceWorkerRegistration* registration = |
| 561 GetContext()->GetLiveRegistration(version->registration_id()); | 561 GetContext()->GetLiveRegistration(version->registration_id()); |
| 562 DCHECK(registration); | 562 DCHECK(registration); |
| 563 | 563 |
| 564 // Set the document URL to the script url in order to allow | |
| 565 // register/unregister/getRegistration on ServiceWorkerGlobalScope. | |
| 566 provider_host->SetDocumentUrl(version->script_url()); | |
|
nhiroki
2015/02/04 05:18:27
I'm not really sure whether we have to call SetTop
kinuko
2015/02/04 07:12:52
Basically topmost_frame_url is used to lookup cook
nhiroki
2015/02/05 05:28:40
I see. Already running worker wouldn't have to tak
| |
| 567 | |
| 564 ServiceWorkerRegistrationObjectInfo info; | 568 ServiceWorkerRegistrationObjectInfo info; |
| 565 ServiceWorkerVersionAttributes attrs; | 569 ServiceWorkerVersionAttributes attrs; |
| 566 GetRegistrationObjectInfoAndVersionAttributes( | 570 GetRegistrationObjectInfoAndVersionAttributes( |
| 567 provider_host->AsWeakPtr(), registration, &info, &attrs); | 571 provider_host->AsWeakPtr(), registration, &info, &attrs); |
| 568 | 572 |
| 569 Send(new ServiceWorkerMsg_AssociateRegistrationWithServiceWorker( | 573 Send(new ServiceWorkerMsg_AssociateRegistrationWithServiceWorker( |
| 570 kDocumentMainThreadId, provider_id, info, attrs)); | 574 kDocumentMainThreadId, provider_id, info, attrs)); |
| 571 } | 575 } |
| 572 | 576 |
| 573 ServiceWorkerRegistrationHandle* | 577 ServiceWorkerRegistrationHandle* |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); | 942 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); |
| 939 if (!handle) { | 943 if (!handle) { |
| 940 BadMessageReceived(); | 944 BadMessageReceived(); |
| 941 return; | 945 return; |
| 942 } | 946 } |
| 943 handle->version()->StopWorker( | 947 handle->version()->StopWorker( |
| 944 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); | 948 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
| 945 } | 949 } |
| 946 | 950 |
| 947 } // namespace content | 951 } // namespace content |
| OLD | NEW |