| 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 "base/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "content/child/scoped_child_process_reference.h" | 8 #include "content/child/scoped_child_process_reference.h" |
| 9 #include "content/child/shared_worker_devtools_agent.h" | 9 #include "content/child/shared_worker_devtools_agent.h" |
| 10 #include "content/child/webmessageportchannel_impl.h" | 10 #include "content/child/webmessageportchannel_impl.h" |
| 11 #include "content/common/worker_messages.h" | 11 #include "content/common/worker_messages.h" |
| 12 #include "content/renderer/render_thread_impl.h" | 12 #include "content/renderer/render_thread_impl.h" |
| 13 #include "ipc/ipc_message_macros.h" | 13 #include "ipc/ipc_message_macros.h" |
| 14 #include "third_party/WebKit/public/web/WebSharedWorker.h" | 14 #include "third_party/WebKit/public/web/WebSharedWorker.h" |
| 15 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h" | 15 #include "third_party/WebKit/public/web/WebSharedWorkerClient.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( | 19 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( |
| 20 const GURL& url, | 20 const GURL& url, |
| 21 const base::string16& name, | 21 const base::string16& name, |
| 22 const base::string16& content_security_policy, | 22 const base::string16& content_security_policy, |
| 23 blink::WebContentSecurityPolicyType security_policy_type, | 23 blink::WebContentSecurityPolicyType security_policy_type, |
| 24 bool pause_on_start, |
| 24 int route_id) | 25 int route_id) |
| 25 : route_id_(route_id), | 26 : route_id_(route_id), name_(name), runing_(false), url_(url) { |
| 26 name_(name), | |
| 27 runing_(false), | |
| 28 url_(url) { | |
| 29 RenderThreadImpl::current()->AddSharedWorkerRoute(route_id_, this); | 27 RenderThreadImpl::current()->AddSharedWorkerRoute(route_id_, this); |
| 30 impl_ = blink::WebSharedWorker::create(this); | 28 impl_ = blink::WebSharedWorker::create(this); |
| 29 if (pause_on_start) { |
| 30 // Pause worker context when it starts and wait until either DevTools client |
| 31 // is attached or explicit resume notification is received. |
| 32 impl_->pauseWorkerContextOnStart(); |
| 33 } |
| 31 worker_devtools_agent_.reset( | 34 worker_devtools_agent_.reset( |
| 32 new SharedWorkerDevToolsAgent(route_id, impl_)); | 35 new SharedWorkerDevToolsAgent(route_id, impl_)); |
| 33 impl_->startWorkerContext(url, name_, | 36 impl_->startWorkerContext(url, name_, |
| 34 content_security_policy, security_policy_type); | 37 content_security_policy, security_policy_type); |
| 35 } | 38 } |
| 36 | 39 |
| 37 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { | 40 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { |
| 38 RenderThreadImpl::current()->RemoveSharedWorkerRoute(route_id_); | 41 RenderThreadImpl::current()->RemoveSharedWorkerRoute(route_id_); |
| 39 } | 42 } |
| 40 | 43 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 pending_channels_.push_back(channel); | 158 pending_channels_.push_back(channel); |
| 156 } | 159 } |
| 157 } | 160 } |
| 158 | 161 |
| 159 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 162 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
| 160 runing_ = false; | 163 runing_ = false; |
| 161 impl_->terminateWorkerContext(); | 164 impl_->terminateWorkerContext(); |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // namespace content | 167 } // namespace content |
| OLD | NEW |