Chromium Code Reviews| Index: content/browser/service_worker/service_worker_dispatcher_host.cc |
| diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| index c531e915e888504b1396aa27dab35bf4db51b7a3..621973e892472dbd02b177b234997e867a9c71ae 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| @@ -19,7 +19,6 @@ ServiceWorkerDispatcherHost::~ServiceWorkerDispatcherHost() {} |
| bool ServiceWorkerDispatcherHost::OnMessageReceived(const IPC::Message& message, |
| bool* message_was_ok) { |
| - |
| if (IPC_MESSAGE_CLASS(message) != ServiceWorkerMsgStart) |
| return false; |
| @@ -36,15 +35,28 @@ bool ServiceWorkerDispatcherHost::OnMessageReceived(const IPC::Message& message, |
| return handled; |
| } |
| -void ServiceWorkerDispatcherHost::OnRegisterServiceWorker(int32 registry_id, |
| - const string16& scope, |
| - const GURL& script_url) { |
| +// TODO(alecflett): Store the worker_id keyed by (domain+pattern, |
| +// script) so we don't always return a new service worker id. |
| +static int32 NextWorkerId() { |
|
michaeln
2013/10/04 01:26:07
i think we usually prefer 'int' where int will do
alecflett
2013/10/07 18:33:58
cpplint will warn/complain if you use native types
|
| + static int32 worker_id = 0; |
| + return worker_id++; |
| +} |
| + |
| +void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( |
| + int32 request_id, |
| + const string16& scope, |
| + const GURL& script_url) { |
| // TODO(alecflett): Enforce that script_url must have the same |
| // origin as the registering document. |
|
michaeln
2013/10/04 01:26:07
I'd vote to put in place scaffolding/structure tha
alecflett
2013/10/07 18:33:58
OK
|
| + Send( |
| + new ServiceWorkerMsg_ServiceWorkerRegistered(request_id, NextWorkerId())); |
| } |
| void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( |
| - int32 registry_id, |
| - const string16& scope) {} |
| + int32 request_id, |
| + const string16& scope) { |
| + Send(new ServiceWorkerMsg_ServiceWorkerUnregistered(request_id, |
| + NextWorkerId())); |
| +} |
| } // namespace content |