| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 RenderThreadImpl::current()->thread_safe_sender()->Send( | 56 RenderThreadImpl::current()->thread_safe_sender()->Send( |
| 57 new EmbeddedWorkerHostMsg_WorkerStopped(embedded_worker_id)); | 57 new EmbeddedWorkerHostMsg_WorkerStopped(embedded_worker_id)); |
| 58 workers_.Remove(embedded_worker_id); | 58 workers_.Remove(embedded_worker_id); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void EmbeddedWorkerDispatcher::OnStartWorker( | 61 void EmbeddedWorkerDispatcher::OnStartWorker( |
| 62 int embedded_worker_id, | 62 int embedded_worker_id, |
| 63 int64 service_worker_version_id, | 63 int64 service_worker_version_id, |
| 64 const GURL& script_url) { | 64 const GURL& script_url) { |
| 65 DCHECK(!workers_.Lookup(embedded_worker_id)); | 65 DCHECK(!workers_.Lookup(embedded_worker_id)); |
| 66 RenderThread::Get()->EnsureWebKitInitialized(); |
| 66 scoped_ptr<WorkerWrapper> wrapper(new WorkerWrapper( | 67 scoped_ptr<WorkerWrapper> wrapper(new WorkerWrapper( |
| 67 blink::WebEmbeddedWorker::create( | 68 blink::WebEmbeddedWorker::create( |
| 68 new EmbeddedWorkerContextClient( | 69 new EmbeddedWorkerContextClient( |
| 69 embedded_worker_id, | 70 embedded_worker_id, |
| 70 service_worker_version_id, | 71 service_worker_version_id, |
| 71 script_url), | 72 script_url), |
| 72 NULL))); | 73 NULL))); |
| 73 | 74 |
| 74 blink::WebEmbeddedWorkerStartData start_data; | 75 blink::WebEmbeddedWorkerStartData start_data; |
| 75 start_data.scriptURL = script_url; | 76 start_data.scriptURL = script_url; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 87 return; | 88 return; |
| 88 } | 89 } |
| 89 | 90 |
| 90 // This should eventually call WorkerContextDestroyed. (We may need to post | 91 // This should eventually call WorkerContextDestroyed. (We may need to post |
| 91 // a delayed task to forcibly abort the worker context if we find it | 92 // a delayed task to forcibly abort the worker context if we find it |
| 92 // necessary) | 93 // necessary) |
| 93 wrapper->worker()->terminateWorkerContext(); | 94 wrapper->worker()->terminateWorkerContext(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace content | 97 } // namespace content |
| OLD | NEW |