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

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

Issue 2746783002: [ServiceWorker] Mojofy InstallEvent of Service Worker (Closed)
Patch Set: Rebase and address falken, leon and mek's comments 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 945 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 OnClearCachedMetadata) 956 OnClearCachedMetadata)
957 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessageToClient, 957 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessageToClient,
958 OnPostMessageToClient) 958 OnPostMessageToClient)
959 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FocusClient, 959 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FocusClient,
960 OnFocusClient) 960 OnFocusClient)
961 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NavigateClient, OnNavigateClient) 961 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NavigateClient, OnNavigateClient)
962 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SkipWaiting, 962 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SkipWaiting,
963 OnSkipWaiting) 963 OnSkipWaiting)
964 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ClaimClients, 964 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ClaimClients,
965 OnClaimClients) 965 OnClaimClients)
966 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_RegisterForeignFetchScopes,
967 OnRegisterForeignFetchScopes)
968 IPC_MESSAGE_UNHANDLED(handled = false) 966 IPC_MESSAGE_UNHANDLED(handled = false)
969 IPC_END_MESSAGE_MAP() 967 IPC_END_MESSAGE_MAP()
970 return handled; 968 return handled;
971 } 969 }
972 970
973 void ServiceWorkerVersion::OnStartSentAndScriptEvaluated( 971 void ServiceWorkerVersion::OnStartSentAndScriptEvaluated(
974 ServiceWorkerStatusCode status) { 972 ServiceWorkerStatusCode status) {
975 if (status != SERVICE_WORKER_OK) { 973 if (status != SERVICE_WORKER_OK) {
976 scoped_refptr<ServiceWorkerVersion> protect(this); 974 scoped_refptr<ServiceWorkerVersion> protect(this);
977 FinishStartWorker(DeduceStartWorkerFailureReason(status)); 975 FinishStartWorker(DeduceStartWorkerFailureReason(status));
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 1375
1378 embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError( 1376 embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
1379 request_id, blink::WebServiceWorkerError::ErrorTypeAbort, 1377 request_id, blink::WebServiceWorkerError::ErrorTypeAbort,
1380 base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage))); 1378 base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage)));
1381 } 1379 }
1382 1380
1383 void ServiceWorkerVersion::OnPongFromWorker() { 1381 void ServiceWorkerVersion::OnPongFromWorker() {
1384 ping_controller_->OnPongReceived(); 1382 ping_controller_->OnPongReceived();
1385 } 1383 }
1386 1384
1387 void ServiceWorkerVersion::OnRegisterForeignFetchScopes( 1385 void ServiceWorkerVersion::RegisterForeignFetchScopes(
1388 const std::vector<GURL>& sub_scopes, 1386 const std::vector<GURL>& sub_scopes,
1389 const std::vector<url::Origin>& origins) { 1387 const std::vector<url::Origin>& origins) {
1390 DCHECK(status() == INSTALLING || status() == REDUNDANT) << status(); 1388 DCHECK(status() == INSTALLING || status() == REDUNDANT) << status();
1391 // Renderer should have already verified all these urls are inside the 1389 // Renderer should have already verified all these urls are inside the
1392 // worker's scope, but verify again here on the browser process side. 1390 // worker's scope, but verify again here on the browser process side.
1393 GURL origin = scope_.GetOrigin(); 1391 GURL origin = scope_.GetOrigin();
1394 std::string scope_path = scope_.path(); 1392 std::string scope_path = scope_.path();
1395 for (const GURL& url : sub_scopes) { 1393 for (const GURL& url : sub_scopes) {
1396 if (!url.is_valid() || url.GetOrigin() != origin || 1394 if (!url.is_valid() || url.GetOrigin() != origin ||
1397 !base::StartsWith(url.path(), scope_path, 1395 !base::StartsWith(url.path(), scope_path,
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 1885
1888 void ServiceWorkerVersion::CleanUpExternalRequest( 1886 void ServiceWorkerVersion::CleanUpExternalRequest(
1889 const std::string& request_uuid, 1887 const std::string& request_uuid,
1890 ServiceWorkerStatusCode status) { 1888 ServiceWorkerStatusCode status) {
1891 if (status == SERVICE_WORKER_OK) 1889 if (status == SERVICE_WORKER_OK)
1892 return; 1890 return;
1893 external_request_uuid_to_request_id_.erase(request_uuid); 1891 external_request_uuid_to_request_id_.erase(request_uuid);
1894 } 1892 }
1895 1893
1896 } // namespace content 1894 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698