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(int embedded_worker_id, | 61 void EmbeddedWorkerDispatcher::OnStartWorker(int embedded_worker_id, |
62 int64 service_worker_version_id, | 62 int64 service_worker_version_id, |
63 const GURL& service_worker_scope, | 63 const GURL& service_worker_scope, |
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(); | |
Jeffrey Yasskin
2014/04/25 04:40:33
This is needed if the SW is the first code run in
| |
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 service_worker_scope, | 72 service_worker_scope, |
72 script_url), | 73 script_url), |
73 NULL))); | 74 NULL))); |
74 | 75 |
75 blink::WebEmbeddedWorkerStartData start_data; | 76 blink::WebEmbeddedWorkerStartData start_data; |
(...skipping 12 matching lines...) Expand all Loading... | |
88 return; | 89 return; |
89 } | 90 } |
90 | 91 |
91 // This should eventually call WorkerContextDestroyed. (We may need to post | 92 // This should eventually call WorkerContextDestroyed. (We may need to post |
92 // a delayed task to forcibly abort the worker context if we find it | 93 // a delayed task to forcibly abort the worker context if we find it |
93 // necessary) | 94 // necessary) |
94 wrapper->worker()->terminateWorkerContext(); | 95 wrapper->worker()->terminateWorkerContext(); |
95 } | 96 } |
96 | 97 |
97 } // namespace content | 98 } // namespace content |
OLD | NEW |