| 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/appcache/appcache_dispatcher.h" | 8 #include "content/child/appcache/appcache_dispatcher.h" |
| 9 #include "content/child/appcache/web_application_cache_host_impl.h" | 9 #include "content/child/appcache/web_application_cache_host_impl.h" |
| 10 #include "content/child/scoped_child_process_reference.h" | 10 #include "content/child/scoped_child_process_reference.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 } | 52 } |
| 53 }; | 53 }; |
| 54 } | 54 } |
| 55 | 55 |
| 56 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( | 56 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( |
| 57 const GURL& url, | 57 const GURL& url, |
| 58 const base::string16& name, | 58 const base::string16& name, |
| 59 const base::string16& content_security_policy, | 59 const base::string16& content_security_policy, |
| 60 blink::WebContentSecurityPolicyType security_policy_type, | 60 blink::WebContentSecurityPolicyType security_policy_type, |
| 61 bool pause_on_start, | 61 bool pause_on_start, |
| 62 int route_id) | 62 int route_id, |
| 63 : route_id_(route_id), name_(name), runing_(false), url_(url) { | 63 const base::string16& accept_languages |
| 64 ) |
| 65 : route_id_(route_id), name_(name), runing_(false), url_(url) |
| 66 , accept_languages_(accept_languages){ |
| 64 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); | 67 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); |
| 65 impl_ = blink::WebSharedWorker::create(this); | 68 impl_ = blink::WebSharedWorker::create(this); |
| 66 if (pause_on_start) { | 69 if (pause_on_start) { |
| 67 // Pause worker context when it starts and wait until either DevTools client | 70 // Pause worker context when it starts and wait until either DevTools client |
| 68 // is attached or explicit resume notification is received. | 71 // is attached or explicit resume notification is received. |
| 69 impl_->pauseWorkerContextOnStart(); | 72 impl_->pauseWorkerContextOnStart(); |
| 70 } | 73 } |
| 71 worker_devtools_agent_.reset( | 74 worker_devtools_agent_.reset( |
| 72 new SharedWorkerDevToolsAgent(route_id, impl_)); | 75 new SharedWorkerDevToolsAgent(route_id, impl_)); |
| 73 impl_->startWorkerContext(url, name_, | 76 impl_->startWorkerContext(url, name_, content_security_policy |
| 74 content_security_policy, security_policy_type); | 77 , security_policy_type, accept_languages_); |
| 75 } | 78 } |
| 76 | 79 |
| 77 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { | 80 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { |
| 78 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); | 81 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); |
| 79 } | 82 } |
| 80 | 83 |
| 81 bool EmbeddedSharedWorkerStub::OnMessageReceived( | 84 bool EmbeddedSharedWorkerStub::OnMessageReceived( |
| 82 const IPC::Message& message) { | 85 const IPC::Message& message) { |
| 83 if (worker_devtools_agent_->OnMessageReceived(message)) | 86 if (worker_devtools_agent_->OnMessageReceived(message)) |
| 84 return true; | 87 return true; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 pending_channels_.push_back(channel); | 210 pending_channels_.push_back(channel); |
| 208 } | 211 } |
| 209 } | 212 } |
| 210 | 213 |
| 211 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 214 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
| 212 runing_ = false; | 215 runing_ = false; |
| 213 impl_->terminateWorkerContext(); | 216 impl_->terminateWorkerContext(); |
| 214 } | 217 } |
| 215 | 218 |
| 216 } // namespace content | 219 } // namespace content |
| OLD | NEW |