| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 params.service_worker_version_id, | 75 params.service_worker_version_id, |
| 76 params.scope, | 76 params.scope, |
| 77 params.script_url, | 77 params.script_url, |
| 78 params.worker_devtools_agent_route_id), | 78 params.worker_devtools_agent_route_id), |
| 79 NULL), | 79 NULL), |
| 80 params.worker_devtools_agent_route_id)); | 80 params.worker_devtools_agent_route_id)); |
| 81 | 81 |
| 82 blink::WebEmbeddedWorkerStartData start_data; | 82 blink::WebEmbeddedWorkerStartData start_data; |
| 83 start_data.scriptURL = params.script_url; | 83 start_data.scriptURL = params.script_url; |
| 84 start_data.userAgent = base::UTF8ToUTF16(GetContentClient()->GetUserAgent()); | 84 start_data.userAgent = base::UTF8ToUTF16(GetContentClient()->GetUserAgent()); |
| 85 start_data.startMode = blink::WebEmbeddedWorkerStartModeDontPauseOnStart; | 85 start_data.startMode = |
| 86 params.pause_on_start ? blink::WebEmbeddedWorkerStartModePauseOnStart |
| 87 : blink::WebEmbeddedWorkerStartModeDontPauseOnStart; |
| 86 | 88 |
| 87 wrapper->worker()->startWorkerContext(start_data); | 89 wrapper->worker()->startWorkerContext(start_data); |
| 88 workers_.AddWithID(wrapper.release(), params.embedded_worker_id); | 90 workers_.AddWithID(wrapper.release(), params.embedded_worker_id); |
| 89 } | 91 } |
| 90 | 92 |
| 91 void EmbeddedWorkerDispatcher::OnStopWorker(int embedded_worker_id) { | 93 void EmbeddedWorkerDispatcher::OnStopWorker(int embedded_worker_id) { |
| 92 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); | 94 WorkerWrapper* wrapper = workers_.Lookup(embedded_worker_id); |
| 93 if (!wrapper) { | 95 if (!wrapper) { |
| 94 LOG(WARNING) << "Got OnStopWorker for nonexistent worker"; | 96 LOG(WARNING) << "Got OnStopWorker for nonexistent worker"; |
| 95 return; | 97 return; |
| 96 } | 98 } |
| 97 | 99 |
| 98 // This should eventually call WorkerContextDestroyed. (We may need to post | 100 // This should eventually call WorkerContextDestroyed. (We may need to post |
| 99 // a delayed task to forcibly abort the worker context if we find it | 101 // a delayed task to forcibly abort the worker context if we find it |
| 100 // necessary) | 102 // necessary) |
| 101 wrapper->worker()->terminateWorkerContext(); | 103 wrapper->worker()->terminateWorkerContext(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 } // namespace content | 106 } // namespace content |
| OLD | NEW |