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

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

Issue 2746783002: [ServiceWorker] Mojofy InstallEvent of Service Worker (Closed)
Patch Set: Rebase Created 3 years, 8 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
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_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 OnClearCachedMetadata) 954 OnClearCachedMetadata)
955 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessageToClient, 955 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessageToClient,
956 OnPostMessageToClient) 956 OnPostMessageToClient)
957 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FocusClient, 957 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FocusClient,
958 OnFocusClient) 958 OnFocusClient)
959 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NavigateClient, OnNavigateClient) 959 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NavigateClient, OnNavigateClient)
960 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SkipWaiting, 960 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SkipWaiting,
961 OnSkipWaiting) 961 OnSkipWaiting)
962 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ClaimClients, 962 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ClaimClients,
963 OnClaimClients) 963 OnClaimClients)
964 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_RegisterForeignFetchScopes,
965 OnRegisterForeignFetchScopes)
966 IPC_MESSAGE_UNHANDLED(handled = false) 964 IPC_MESSAGE_UNHANDLED(handled = false)
967 IPC_END_MESSAGE_MAP() 965 IPC_END_MESSAGE_MAP()
968 return handled; 966 return handled;
969 } 967 }
970 968
971 void ServiceWorkerVersion::OnStartSentAndScriptEvaluated( 969 void ServiceWorkerVersion::OnStartSentAndScriptEvaluated(
972 ServiceWorkerStatusCode status) { 970 ServiceWorkerStatusCode status) {
973 if (status != SERVICE_WORKER_OK) { 971 if (status != SERVICE_WORKER_OK) {
974 scoped_refptr<ServiceWorkerVersion> protect(this); 972 scoped_refptr<ServiceWorkerVersion> protect(this);
975 FinishStartWorker(DeduceStartWorkerFailureReason(status)); 973 FinishStartWorker(DeduceStartWorkerFailureReason(status));
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 1328
1331 embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError( 1329 embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
1332 request_id, blink::WebServiceWorkerError::kErrorTypeAbort, 1330 request_id, blink::WebServiceWorkerError::kErrorTypeAbort,
1333 base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage))); 1331 base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage)));
1334 } 1332 }
1335 1333
1336 void ServiceWorkerVersion::OnPongFromWorker() { 1334 void ServiceWorkerVersion::OnPongFromWorker() {
1337 ping_controller_->OnPongReceived(); 1335 ping_controller_->OnPongReceived();
1338 } 1336 }
1339 1337
1340 void ServiceWorkerVersion::OnRegisterForeignFetchScopes( 1338 void ServiceWorkerVersion::RegisterForeignFetchScopes(
1341 const std::vector<GURL>& sub_scopes, 1339 const std::vector<GURL>& sub_scopes,
1342 const std::vector<url::Origin>& origins) { 1340 const std::vector<url::Origin>& origins) {
1343 DCHECK(status() == INSTALLING || status() == REDUNDANT) << status(); 1341 DCHECK(status() == INSTALLING || status() == REDUNDANT) << status();
1344 // Renderer should have already verified all these urls are inside the 1342 // Renderer should have already verified all these urls are inside the
1345 // worker's scope, but verify again here on the browser process side. 1343 // worker's scope, but verify again here on the browser process side.
1346 GURL origin = scope_.GetOrigin(); 1344 GURL origin = scope_.GetOrigin();
1347 std::string scope_path = scope_.path(); 1345 std::string scope_path = scope_.path();
1348 for (const GURL& url : sub_scopes) { 1346 for (const GURL& url : sub_scopes) {
1349 if (!url.is_valid() || url.GetOrigin() != origin || 1347 if (!url.is_valid() || url.GetOrigin() != origin ||
1350 !base::StartsWith(url.path(), scope_path, 1348 !base::StartsWith(url.path(), scope_path,
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1840 1838
1841 void ServiceWorkerVersion::CleanUpExternalRequest( 1839 void ServiceWorkerVersion::CleanUpExternalRequest(
1842 const std::string& request_uuid, 1840 const std::string& request_uuid,
1843 ServiceWorkerStatusCode status) { 1841 ServiceWorkerStatusCode status) {
1844 if (status == SERVICE_WORKER_OK) 1842 if (status == SERVICE_WORKER_OK)
1845 return; 1843 return;
1846 external_request_uuid_to_request_id_.erase(request_uuid); 1844 external_request_uuid_to_request_id_.erase(request_uuid);
1847 } 1845 }
1848 1846
1849 } // namespace content 1847 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698