Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: content/browser/service_worker/service_worker_dispatcher_host.cc

Issue 893363003: ServiceWorker: Support SWRegistration.unregister() in SWGlobalScope [1/2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update header comment4 Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_context_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 BadMessageReceived(); 576 BadMessageReceived();
577 577
578 // Retrieve the registration associated with |version_id|. 578 // Retrieve the registration associated with |version_id|.
579 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id); 579 ServiceWorkerVersion* version = GetContext()->GetLiveVersion(version_id);
580 if (!version) 580 if (!version)
581 return; 581 return;
582 ServiceWorkerRegistration* registration = 582 ServiceWorkerRegistration* registration =
583 GetContext()->GetLiveRegistration(version->registration_id()); 583 GetContext()->GetLiveRegistration(version->registration_id());
584 DCHECK(registration); 584 DCHECK(registration);
585 585
586 // Set the document URL to the script url in order to allow
587 // register/unregister/getRegistration on ServiceWorkerGlobalScope.
588 provider_host->SetDocumentUrl(version->script_url());
589
586 ServiceWorkerRegistrationObjectInfo info; 590 ServiceWorkerRegistrationObjectInfo info;
587 ServiceWorkerVersionAttributes attrs; 591 ServiceWorkerVersionAttributes attrs;
588 GetRegistrationObjectInfoAndVersionAttributes( 592 GetRegistrationObjectInfoAndVersionAttributes(
589 provider_host->AsWeakPtr(), registration, &info, &attrs); 593 provider_host->AsWeakPtr(), registration, &info, &attrs);
590 594
591 Send(new ServiceWorkerMsg_AssociateRegistrationWithServiceWorker( 595 Send(new ServiceWorkerMsg_AssociateRegistrationWithServiceWorker(
592 kDocumentMainThreadId, provider_id, info, attrs)); 596 kDocumentMainThreadId, provider_id, info, attrs));
593 } 597 }
594 598
595 ServiceWorkerRegistrationHandle* 599 ServiceWorkerRegistrationHandle*
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 ServiceWorkerHandle* handle = handles_.Lookup(handle_id); 968 ServiceWorkerHandle* handle = handles_.Lookup(handle_id);
965 if (!handle) { 969 if (!handle) {
966 BadMessageReceived(); 970 BadMessageReceived();
967 return; 971 return;
968 } 972 }
969 handle->version()->StopWorker( 973 handle->version()->StopWorker(
970 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 974 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
971 } 975 }
972 976
973 } // namespace content 977 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/service_worker/embedded_worker_context_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698