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/feature_list.h" | 10 #include "base/feature_list.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 } // namespace | 121 } // namespace |
122 | 122 |
123 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( | 123 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( |
124 const GURL& url, | 124 const GURL& url, |
125 const base::string16& name, | 125 const base::string16& name, |
126 const base::string16& content_security_policy, | 126 const base::string16& content_security_policy, |
127 blink::WebContentSecurityPolicyType security_policy_type, | 127 blink::WebContentSecurityPolicyType security_policy_type, |
128 blink::WebAddressSpace creation_address_space, | 128 blink::WebAddressSpace creation_address_space, |
129 bool pause_on_start, | 129 bool pause_on_start, |
130 int route_id) | 130 int route_id, |
| 131 blink::WebDataSaverFlag data_saver_flag) |
131 : route_id_(route_id), name_(name), url_(url) { | 132 : route_id_(route_id), name_(name), url_(url) { |
132 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); | 133 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); |
133 impl_ = blink::WebSharedWorker::Create(this); | 134 impl_ = blink::WebSharedWorker::Create(this); |
134 if (pause_on_start) { | 135 if (pause_on_start) { |
135 // Pause worker context when it starts and wait until either DevTools client | 136 // Pause worker context when it starts and wait until either DevTools client |
136 // is attached or explicit resume notification is received. | 137 // is attached or explicit resume notification is received. |
137 impl_->PauseWorkerContextOnStart(); | 138 impl_->PauseWorkerContextOnStart(); |
138 } | 139 } |
139 worker_devtools_agent_.reset( | 140 worker_devtools_agent_.reset( |
140 new SharedWorkerDevToolsAgent(route_id, impl_)); | 141 new SharedWorkerDevToolsAgent(route_id, impl_)); |
141 impl_->StartWorkerContext( | 142 impl_->StartWorkerContext( |
142 url, blink::WebString::FromUTF16(name_), | 143 url, blink::WebString::FromUTF16(name_), |
143 blink::WebString::FromUTF16(content_security_policy), | 144 blink::WebString::FromUTF16(content_security_policy), |
144 security_policy_type, creation_address_space); | 145 security_policy_type, creation_address_space, data_saver_flag); |
145 } | 146 } |
146 | 147 |
147 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { | 148 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { |
148 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); | 149 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); |
149 DCHECK(!impl_); | 150 DCHECK(!impl_); |
150 } | 151 } |
151 | 152 |
152 bool EmbeddedSharedWorkerStub::OnMessageReceived( | 153 bool EmbeddedSharedWorkerStub::OnMessageReceived( |
153 const IPC::Message& message) { | 154 const IPC::Message& message) { |
154 if (worker_devtools_agent_->OnMessageReceived(message)) | 155 if (worker_devtools_agent_->OnMessageReceived(message)) |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 318 } |
318 } | 319 } |
319 | 320 |
320 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 321 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
321 // After this we wouldn't get any IPC for this stub. | 322 // After this we wouldn't get any IPC for this stub. |
322 running_ = false; | 323 running_ = false; |
323 impl_->TerminateWorkerContext(); | 324 impl_->TerminateWorkerContext(); |
324 } | 325 } |
325 | 326 |
326 } // namespace content | 327 } // namespace content |
OLD | NEW |