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

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

Issue 268753004: Add WorkerScriptLoaded message to support attaching DevTools while starting ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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_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 "content/browser/message_port_message_filter.h" 9 #include "content/browser/message_port_message_filter.h"
10 #include "content/browser/message_port_service.h" 10 #include "content/browser/message_port_service.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderDestroyed, 99 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderDestroyed,
100 OnProviderDestroyed) 100 OnProviderDestroyed)
101 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_AddScriptClient, 101 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_AddScriptClient,
102 OnAddScriptClient) 102 OnAddScriptClient)
103 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_RemoveScriptClient, 103 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_RemoveScriptClient,
104 OnRemoveScriptClient) 104 OnRemoveScriptClient)
105 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SetVersionId, 105 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SetVersionId,
106 OnSetHostedVersionId) 106 OnSetHostedVersionId)
107 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessage, 107 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PostMessage,
108 OnPostMessage) 108 OnPostMessage)
109 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerScriptLoaded,
110 OnWorkerScriptLoaded)
109 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStarted, 111 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStarted,
110 OnWorkerStarted) 112 OnWorkerStarted)
111 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStopped, 113 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStopped,
112 OnWorkerStopped) 114 OnWorkerStopped)
113 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_ReportException, 115 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_ReportException,
114 OnReportException) 116 OnReportException)
115 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_ReportConsoleMessage, 117 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_ReportConsoleMessage,
116 OnReportConsoleMessage) 118 OnReportConsoleMessage)
117 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ServiceWorkerObjectDestroyed, 119 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ServiceWorkerObjectDestroyed,
118 OnServiceWorkerObjectDestroyed) 120 OnServiceWorkerObjectDestroyed)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ServiceWorkerVersion* version = context_->GetLiveVersion(version_id); 325 ServiceWorkerVersion* version = context_->GetLiveVersion(version_id);
324 DCHECK(version); 326 DCHECK(version);
325 DCHECK_EQ(registration_id, version->registration_id()); 327 DCHECK_EQ(registration_id, version->registration_id());
326 scoped_ptr<ServiceWorkerHandle> handle = 328 scoped_ptr<ServiceWorkerHandle> handle =
327 ServiceWorkerHandle::Create(context_, this, thread_id, version); 329 ServiceWorkerHandle::Create(context_, this, thread_id, version);
328 Send(new ServiceWorkerMsg_ServiceWorkerRegistered( 330 Send(new ServiceWorkerMsg_ServiceWorkerRegistered(
329 thread_id, request_id, handle->GetObjectInfo())); 331 thread_id, request_id, handle->GetObjectInfo()));
330 RegisterServiceWorkerHandle(handle.Pass()); 332 RegisterServiceWorkerHandle(handle.Pass());
331 } 333 }
332 334
335 void ServiceWorkerDispatcherHost::OnWorkerScriptLoaded(int embedded_worker_id) {
336 if (!context_)
337 return;
338 context_->embedded_worker_registry()->OnWorkerScriptLoaded(
339 render_process_id_, embedded_worker_id);
340 }
341
333 void ServiceWorkerDispatcherHost::OnWorkerStarted( 342 void ServiceWorkerDispatcherHost::OnWorkerStarted(
334 int thread_id, int embedded_worker_id) { 343 int thread_id, int embedded_worker_id) {
335 if (!context_) 344 if (!context_)
336 return; 345 return;
337 context_->embedded_worker_registry()->OnWorkerStarted( 346 context_->embedded_worker_registry()->OnWorkerStarted(
338 render_process_id_, thread_id, embedded_worker_id); 347 render_process_id_, thread_id, embedded_worker_id);
339 } 348 }
340 349
341 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) { 350 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) {
342 if (!context_) 351 if (!context_)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 ServiceWorkerStatusCode status) { 406 ServiceWorkerStatusCode status) {
398 base::string16 error_message; 407 base::string16 error_message;
399 blink::WebServiceWorkerError::ErrorType error_type; 408 blink::WebServiceWorkerError::ErrorType error_type;
400 GetServiceWorkerRegistrationStatusResponse( 409 GetServiceWorkerRegistrationStatusResponse(
401 status, &error_type, &error_message); 410 status, &error_type, &error_message);
402 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 411 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
403 thread_id, request_id, error_type, error_message)); 412 thread_id, request_id, error_type, error_message));
404 } 413 }
405 414
406 } // namespace content 415 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698