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