Chromium Code Reviews| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "content/child/child_process.h" | 12 #include "content/child/child_process.h" |
| 13 #include "content/child/scoped_child_process_reference.h" | 13 #include "content/child/scoped_child_process_reference.h" |
| 14 #include "content/child/thread_safe_sender.h" | 14 #include "content/child/thread_safe_sender.h" |
| 15 #include "content/child/worker_thread_registry.h" | 15 #include "content/child/worker_thread_registry.h" |
| 16 #include "content/common/devtools_messages.h" | 16 #include "content/common/devtools_messages.h" |
| 17 #include "content/common/service_worker/embedded_worker_messages.h" | 17 #include "content/common/service_worker/embedded_worker_messages.h" |
| 18 #include "content/public/common/content_client.h" | 18 #include "content/public/common/content_client.h" |
| 19 #include "content/public/renderer/content_renderer_client.h" | |
| 19 #include "content/renderer/render_thread_impl.h" | 20 #include "content/renderer/render_thread_impl.h" |
| 20 #include "content/renderer/service_worker/embedded_worker_devtools_agent.h" | 21 #include "content/renderer/service_worker/embedded_worker_devtools_agent.h" |
| 21 #include "content/renderer/service_worker/service_worker_context_client.h" | 22 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 22 #include "third_party/WebKit/public/platform/WebString.h" | 23 #include "third_party/WebKit/public/platform/WebString.h" |
| 23 #include "third_party/WebKit/public/platform/WebURL.h" | 24 #include "third_party/WebKit/public/platform/WebURL.h" |
| 24 #include "third_party/WebKit/public/web/WebEmbeddedWorker.h" | 25 #include "third_party/WebKit/public/web/WebEmbeddedWorker.h" |
| 25 #include "third_party/WebKit/public/web/WebEmbeddedWorkerStartData.h" | 26 #include "third_party/WebKit/public/web/WebEmbeddedWorkerStartData.h" |
| 26 | 27 |
| 27 namespace content { | 28 namespace content { |
| 28 | 29 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 | 73 |
| 73 RenderThreadImpl::current()->thread_safe_sender()->Send( | 74 RenderThreadImpl::current()->thread_safe_sender()->Send( |
| 74 new EmbeddedWorkerHostMsg_WorkerStopped(embedded_worker_id)); | 75 new EmbeddedWorkerHostMsg_WorkerStopped(embedded_worker_id)); |
| 75 workers_.Remove(embedded_worker_id); | 76 workers_.Remove(embedded_worker_id); |
| 76 } | 77 } |
| 77 | 78 |
| 78 void EmbeddedWorkerDispatcher::OnStartWorker( | 79 void EmbeddedWorkerDispatcher::OnStartWorker( |
| 79 const EmbeddedWorkerMsg_StartWorker_Params& params) { | 80 const EmbeddedWorkerMsg_StartWorker_Params& params) { |
| 80 DCHECK(!workers_.Lookup(params.embedded_worker_id)); | 81 DCHECK(!workers_.Lookup(params.embedded_worker_id)); |
| 81 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerDispatcher::OnStartWorker"); | 82 TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerDispatcher::OnStartWorker"); |
| 83 GetContentClient()->renderer()->InstallV8ExtensionForServiceWorkers(); | |
|
falken
2016/04/20 02:31:46
I don't understand V8 Extensions, but it looks lik
lazyboy
2016/04/21 05:52:15
I've added params.script_url to the function to ba
| |
| 82 std::unique_ptr<WorkerWrapper> wrapper(new WorkerWrapper( | 84 std::unique_ptr<WorkerWrapper> wrapper(new WorkerWrapper( |
| 83 blink::WebEmbeddedWorker::create( | 85 blink::WebEmbeddedWorker::create( |
| 84 new ServiceWorkerContextClient(params.embedded_worker_id, | 86 new ServiceWorkerContextClient(params.embedded_worker_id, |
| 85 params.service_worker_version_id, | 87 params.service_worker_version_id, |
| 86 params.scope, params.script_url, | 88 params.scope, params.script_url, |
| 87 params.worker_devtools_agent_route_id), | 89 params.worker_devtools_agent_route_id), |
| 88 NULL), | 90 NULL), |
| 89 params.worker_devtools_agent_route_id)); | 91 params.worker_devtools_agent_route_id)); |
| 90 | 92 |
| 91 blink::WebEmbeddedWorkerStartData start_data; | 93 blink::WebEmbeddedWorkerStartData start_data; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 "EmbeddedWorkerDispatcher::OnResumeAfterDownload"); | 129 "EmbeddedWorkerDispatcher::OnResumeAfterDownload"); |
| 128 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); | 130 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); |
| 129 if (!wrapper) { | 131 if (!wrapper) { |
| 130 LOG(WARNING) << "Got OnResumeAfterDownload for nonexistent worker"; | 132 LOG(WARNING) << "Got OnResumeAfterDownload for nonexistent worker"; |
| 131 return; | 133 return; |
| 132 } | 134 } |
| 133 wrapper->worker()->resumeAfterDownload(); | 135 wrapper->worker()->resumeAfterDownload(); |
| 134 } | 136 } |
| 135 | 137 |
| 136 } // namespace content | 138 } // namespace content |
| OLD | NEW |