| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/shared_worker/embedded_shared_worker_stub.h" | 5 #include "content/renderer/shared_worker/embedded_shared_worker_stub.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 : route_id_(route_id), name_(name), url_(url) { | 141 : route_id_(route_id), name_(name), url_(url) { |
| 142 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); | 142 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); |
| 143 impl_ = blink::WebSharedWorker::create(this); | 143 impl_ = blink::WebSharedWorker::create(this); |
| 144 if (pause_on_start) { | 144 if (pause_on_start) { |
| 145 // Pause worker context when it starts and wait until either DevTools client | 145 // Pause worker context when it starts and wait until either DevTools client |
| 146 // is attached or explicit resume notification is received. | 146 // is attached or explicit resume notification is received. |
| 147 impl_->pauseWorkerContextOnStart(); | 147 impl_->pauseWorkerContextOnStart(); |
| 148 } | 148 } |
| 149 worker_devtools_agent_.reset( | 149 worker_devtools_agent_.reset( |
| 150 new SharedWorkerDevToolsAgent(route_id, impl_)); | 150 new SharedWorkerDevToolsAgent(route_id, impl_)); |
| 151 impl_->startWorkerContext(url, name_, content_security_policy, | 151 impl_->startWorkerContext( |
| 152 security_policy_type, creation_address_space); | 152 url, blink::WebString::fromUTF16(name_), |
| 153 blink::WebString::fromUTF16(content_security_policy), |
| 154 security_policy_type, creation_address_space); |
| 153 } | 155 } |
| 154 | 156 |
| 155 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { | 157 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { |
| 156 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); | 158 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); |
| 157 DCHECK(!impl_); | 159 DCHECK(!impl_); |
| 158 } | 160 } |
| 159 | 161 |
| 160 bool EmbeddedSharedWorkerStub::OnMessageReceived( | 162 bool EmbeddedSharedWorkerStub::OnMessageReceived( |
| 161 const IPC::Message& message) { | 163 const IPC::Message& message) { |
| 162 if (worker_devtools_agent_->OnMessageReceived(message)) | 164 if (worker_devtools_agent_->OnMessageReceived(message)) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 314 } |
| 313 } | 315 } |
| 314 | 316 |
| 315 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 317 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
| 316 // After this we wouldn't get any IPC for this stub. | 318 // After this we wouldn't get any IPC for this stub. |
| 317 running_ = false; | 319 running_ = false; |
| 318 impl_->terminateWorkerContext(); | 320 impl_->terminateWorkerContext(); |
| 319 } | 321 } |
| 320 | 322 |
| 321 } // namespace content | 323 } // namespace content |
| OLD | NEW |