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

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

Issue 140893002: Adding slightly clearer separation between SW and EmbeddedWorker (still incomplete) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
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/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "content/browser/service_worker/embedded_worker_registry.h" 8 #include "content/browser/service_worker/embedded_worker_registry.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_UnregisterServiceWorker, 70 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_UnregisterServiceWorker,
71 OnUnregisterServiceWorker) 71 OnUnregisterServiceWorker)
72 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderCreated, 72 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderCreated,
73 OnProviderCreated) 73 OnProviderCreated)
74 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderDestroyed, 74 IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_ProviderDestroyed,
75 OnProviderDestroyed) 75 OnProviderDestroyed)
76 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStarted, 76 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStarted,
77 OnWorkerStarted) 77 OnWorkerStarted)
78 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStopped, 78 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_WorkerStopped,
79 OnWorkerStopped) 79 OnWorkerStopped)
80 IPC_MESSAGE_HANDLER(EmbeddedWorkerHostMsg_SendMessageToBrowser,
81 OnSendMessageToBrowser)
80 IPC_MESSAGE_UNHANDLED(handled = false) 82 IPC_MESSAGE_UNHANDLED(handled = false)
81 IPC_END_MESSAGE_MAP() 83 IPC_END_MESSAGE_MAP()
82 84
83 return handled; 85 return handled;
84 } 86 }
85 87
86 void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( 88 void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(
87 int32 thread_id, 89 int32 thread_id,
88 int32 request_id, 90 int32 request_id,
89 const GURL& pattern, 91 const GURL& pattern,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 render_process_id_, thread_id, embedded_worker_id); 188 render_process_id_, thread_id, embedded_worker_id);
187 } 189 }
188 190
189 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) { 191 void ServiceWorkerDispatcherHost::OnWorkerStopped(int embedded_worker_id) {
190 if (!context_) 192 if (!context_)
191 return; 193 return;
192 context_->embedded_worker_registry()->OnWorkerStopped( 194 context_->embedded_worker_registry()->OnWorkerStopped(
193 render_process_id_, embedded_worker_id); 195 render_process_id_, embedded_worker_id);
194 } 196 }
195 197
198 void ServiceWorkerDispatcherHost::OnSendMessageToBrowser(
199 int embedded_worker_id,
200 const IPC::Message& message) {
201 if (!context_)
202 return;
203 context_->embedded_worker_registry()->OnSendMessageToBrowser(
204 embedded_worker_id, message);
205 }
206
196 void ServiceWorkerDispatcherHost::UnregistrationComplete( 207 void ServiceWorkerDispatcherHost::UnregistrationComplete(
197 int32 thread_id, 208 int32 thread_id,
198 int32 request_id, 209 int32 request_id,
199 ServiceWorkerRegistrationStatus status) { 210 ServiceWorkerRegistrationStatus status) {
200 if (status != REGISTRATION_OK) { 211 if (status != REGISTRATION_OK) {
201 SendRegistrationError(thread_id, request_id, status); 212 SendRegistrationError(thread_id, request_id, status);
202 return; 213 return;
203 } 214 }
204 215
205 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id)); 216 Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(thread_id, request_id));
206 } 217 }
207 218
208 void ServiceWorkerDispatcherHost::SendRegistrationError( 219 void ServiceWorkerDispatcherHost::SendRegistrationError(
209 int32 thread_id, 220 int32 thread_id,
210 int32 request_id, 221 int32 request_id,
211 ServiceWorkerRegistrationStatus status) { 222 ServiceWorkerRegistrationStatus status) {
212 base::string16 error_message; 223 base::string16 error_message;
213 blink::WebServiceWorkerError::ErrorType error_type; 224 blink::WebServiceWorkerError::ErrorType error_type;
214 GetServiceWorkerRegistrationStatusResponse( 225 GetServiceWorkerRegistrationStatusResponse(
215 status, &error_type, &error_message); 226 status, &error_type, &error_message);
216 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( 227 Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
217 thread_id, request_id, error_type, error_message)); 228 thread_id, request_id, error_type, error_message));
218 } 229 }
219 230
220 } // namespace content 231 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698