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

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 912753002: Stop Service Workers that execute JavaScript for too long. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rethink 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/service_worker/service_worker_script_context.h" 5 #include "content/renderer/service_worker/service_worker_script_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "content/child/notifications/notification_data_conversions.h" 10 #include "content/child/notifications/notification_data_conversions.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 OnDidGetClientDocuments) 120 OnDidGetClientDocuments)
121 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowResponse, 121 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowResponse,
122 OnOpenWindowResponse) 122 OnOpenWindowResponse)
123 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowError, 123 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_OpenWindowError,
124 OnOpenWindowError) 124 OnOpenWindowError)
125 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse, 125 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse,
126 OnFocusClientResponse) 126 OnFocusClientResponse)
127 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting) 127 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting)
128 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients) 128 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients)
129 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError) 129 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError)
130 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Ping, OnPing);
130 IPC_MESSAGE_UNHANDLED(handled = false) 131 IPC_MESSAGE_UNHANDLED(handled = false)
131 IPC_END_MESSAGE_MAP() 132 IPC_END_MESSAGE_MAP()
132 133
133 // TODO(gavinp): Would it be preferable to put an AddListener() method to 134 // TODO(gavinp): Would it be preferable to put an AddListener() method to
134 // EmbeddedWorkerContextClient? 135 // EmbeddedWorkerContextClient?
135 if (!handled) 136 if (!handled)
136 handled = cache_storage_dispatcher_->OnMessageReceived(message); 137 handled = cache_storage_dispatcher_->OnMessageReceived(message);
137 138
138 DCHECK(handled); 139 DCHECK(handled);
139 } 140 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 if (!callbacks) { 576 if (!callbacks) {
576 NOTREACHED() << "Got stray response: " << request_id; 577 NOTREACHED() << "Got stray response: " << request_id;
577 return; 578 return;
578 } 579 }
579 scoped_ptr<blink::WebServiceWorkerError> error( 580 scoped_ptr<blink::WebServiceWorkerError> error(
580 new blink::WebServiceWorkerError(error_type, message)); 581 new blink::WebServiceWorkerError(error_type, message));
581 callbacks->onError(error.release()); 582 callbacks->onError(error.release());
582 pending_claim_clients_callbacks_.Remove(request_id); 583 pending_claim_clients_callbacks_.Remove(request_id);
583 } 584 }
584 585
586 void ServiceWorkerScriptContext::OnPing() {
587 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID()));
588 }
589
585 } // namespace content 590 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698