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, | |
25 int route_id) | 24 int route_id) |
26 : route_id_(route_id), name_(name), runing_(false), url_(url) { | 25 : route_id_(route_id), |
| 26 name_(name), |
| 27 runing_(false), |
| 28 url_(url) { |
27 RenderThreadImpl::current()->AddSharedWorkerRoute(route_id_, this); | 29 RenderThreadImpl::current()->AddSharedWorkerRoute(route_id_, this); |
28 impl_ = blink::WebSharedWorker::create(this); | 30 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 } | |
34 worker_devtools_agent_.reset( | 31 worker_devtools_agent_.reset( |
35 new SharedWorkerDevToolsAgent(route_id, impl_)); | 32 new SharedWorkerDevToolsAgent(route_id, impl_)); |
36 impl_->startWorkerContext(url, name_, | 33 impl_->startWorkerContext(url, name_, |
37 content_security_policy, security_policy_type); | 34 content_security_policy, security_policy_type); |
38 } | 35 } |
39 | 36 |
40 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { | 37 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { |
41 RenderThreadImpl::current()->RemoveSharedWorkerRoute(route_id_); | 38 RenderThreadImpl::current()->RemoveSharedWorkerRoute(route_id_); |
42 } | 39 } |
43 | 40 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 pending_channels_.push_back(channel); | 155 pending_channels_.push_back(channel); |
159 } | 156 } |
160 } | 157 } |
161 | 158 |
162 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 159 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
163 runing_ = false; | 160 runing_ = false; |
164 impl_->terminateWorkerContext(); | 161 impl_->terminateWorkerContext(); |
165 } | 162 } |
166 | 163 |
167 } // namespace content | 164 } // namespace content |
OLD | NEW |