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

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

Issue 2763453002: [ServiceWorker] Convert ping-pong IPC into mojo interface ServiceWorkerEventDispatcher (Closed)
Patch Set: Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_context_client.h" 5 #include "content/renderer/service_worker/service_worker_context_client.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 OnOpenWindowError) 412 OnOpenWindowError)
413 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse, 413 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_FocusClientResponse,
414 OnFocusClientResponse) 414 OnFocusClientResponse)
415 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_NavigateClientResponse, 415 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_NavigateClientResponse,
416 OnNavigateClientResponse) 416 OnNavigateClientResponse)
417 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_NavigateClientError, 417 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_NavigateClientError,
418 OnNavigateClientError) 418 OnNavigateClientError)
419 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting) 419 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidSkipWaiting, OnDidSkipWaiting)
420 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients) 420 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_DidClaimClients, OnDidClaimClients)
421 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError) 421 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_ClaimClientsError, OnClaimClientsError)
422 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_Ping, OnPing);
423 IPC_MESSAGE_UNHANDLED(handled = false) 422 IPC_MESSAGE_UNHANDLED(handled = false)
424 IPC_END_MESSAGE_MAP() 423 IPC_END_MESSAGE_MAP()
425 DCHECK(handled); 424 DCHECK(handled);
426 } 425 }
427 426
428 blink::WebURL ServiceWorkerContextClient::scope() const { 427 blink::WebURL ServiceWorkerContextClient::scope() const {
429 return service_worker_scope_; 428 return service_worker_scope_;
430 } 429 }
431 430
432 void ServiceWorkerContextClient::getClient( 431 void ServiceWorkerContextClient::getClient(
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 context_->claim_clients_callbacks.Lookup(request_id); 1255 context_->claim_clients_callbacks.Lookup(request_id);
1257 if (!callbacks) { 1256 if (!callbacks) {
1258 NOTREACHED() << "Got stray response: " << request_id; 1257 NOTREACHED() << "Got stray response: " << request_id;
1259 return; 1258 return;
1260 } 1259 }
1261 callbacks->onError(blink::WebServiceWorkerError( 1260 callbacks->onError(blink::WebServiceWorkerError(
1262 error_type, blink::WebString::fromUTF16(message))); 1261 error_type, blink::WebString::fromUTF16(message)));
1263 context_->claim_clients_callbacks.Remove(request_id); 1262 context_->claim_clients_callbacks.Remove(request_id);
1264 } 1263 }
1265 1264
1266 void ServiceWorkerContextClient::OnPing() { 1265 void ServiceWorkerContextClient::Ping(const PingCallback& callback) {
1267 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID())); 1266 callback.Run();
1268 } 1267 }
1269 1268
1270 void ServiceWorkerContextClient::OnNavigationPreloadResponse( 1269 void ServiceWorkerContextClient::OnNavigationPreloadResponse(
1271 int fetch_event_id, 1270 int fetch_event_id,
1272 std::unique_ptr<blink::WebURLResponse> response, 1271 std::unique_ptr<blink::WebURLResponse> response,
1273 std::unique_ptr<blink::WebDataConsumerHandle> data_consumer_handle) { 1272 std::unique_ptr<blink::WebDataConsumerHandle> data_consumer_handle) {
1274 proxy_->onNavigationPreloadResponse(fetch_event_id, std::move(response), 1273 proxy_->onNavigationPreloadResponse(fetch_event_id, std::move(response),
1275 std::move(data_consumer_handle)); 1274 std::move(data_consumer_handle));
1276 } 1275 }
1277 1276
(...skipping 10 matching lines...) Expand all
1288 } 1287 }
1289 1288
1290 base::WeakPtr<ServiceWorkerContextClient> 1289 base::WeakPtr<ServiceWorkerContextClient>
1291 ServiceWorkerContextClient::GetWeakPtr() { 1290 ServiceWorkerContextClient::GetWeakPtr() {
1292 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread()); 1291 DCHECK(worker_task_runner_->RunsTasksOnCurrentThread());
1293 DCHECK(context_); 1292 DCHECK(context_);
1294 return context_->weak_factory.GetWeakPtr(); 1293 return context_->weak_factory.GetWeakPtr();
1295 } 1294 }
1296 1295
1297 } // namespace content 1296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698