| OLD | NEW |
| 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/renderer/service_worker/embedded_worker_dispatcher.h" | 5 #include "content/renderer/service_worker/embedded_worker_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 IPC_BEGIN_MESSAGE_MAP(EmbeddedWorkerDispatcher, message) | 46 IPC_BEGIN_MESSAGE_MAP(EmbeddedWorkerDispatcher, message) |
| 47 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_StartWorker, OnStartWorker) | 47 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_StartWorker, OnStartWorker) |
| 48 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_TerminateWorker, OnTerminateWorker) | 48 IPC_MESSAGE_HANDLER(ServiceWorkerMsg_TerminateWorker, OnTerminateWorker) |
| 49 IPC_MESSAGE_UNHANDLED(handled = false) | 49 IPC_MESSAGE_UNHANDLED(handled = false) |
| 50 IPC_END_MESSAGE_MAP() | 50 IPC_END_MESSAGE_MAP() |
| 51 return handled; | 51 return handled; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void EmbeddedWorkerDispatcher::WorkerContextDestroyed( | 54 void EmbeddedWorkerDispatcher::WorkerContextDestroyed( |
| 55 int embedded_worker_id) { | 55 int embedded_worker_id) { |
| 56 RenderThreadImpl::current()->thread_safe_sender()->Send( |
| 57 new ServiceWorkerHostMsg_WorkerStopped(embedded_worker_id)); |
| 56 workers_.Remove(embedded_worker_id); | 58 workers_.Remove(embedded_worker_id); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void EmbeddedWorkerDispatcher::OnStartWorker( | 61 void EmbeddedWorkerDispatcher::OnStartWorker( |
| 60 int embedded_worker_id, | 62 int embedded_worker_id, |
| 61 int64 service_worker_version_id, | 63 int64 service_worker_version_id, |
| 62 const GURL& script_url) { | 64 const GURL& script_url) { |
| 63 DCHECK(!workers_.Lookup(embedded_worker_id)); | 65 DCHECK(!workers_.Lookup(embedded_worker_id)); |
| 64 scoped_ptr<WorkerWrapper> wrapper(new WorkerWrapper( | 66 scoped_ptr<WorkerWrapper> wrapper(new WorkerWrapper( |
| 65 blink::WebEmbeddedWorker::create( | 67 blink::WebEmbeddedWorker::create( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 85 return; | 87 return; |
| 86 } | 88 } |
| 87 | 89 |
| 88 // This should eventually call WorkerContextDestroyed. (We may need to post | 90 // This should eventually call WorkerContextDestroyed. (We may need to post |
| 89 // a delayed task to forcibly abort the worker context if we find it | 91 // a delayed task to forcibly abort the worker context if we find it |
| 90 // necessary) | 92 // necessary) |
| 91 wrapper->worker()->terminateWorkerContext(); | 93 wrapper->worker()->terminateWorkerContext(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace content | 96 } // namespace content |
| OLD | NEW |