| 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 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( | 54 EmbeddedSharedWorkerStub::EmbeddedSharedWorkerStub( |
| 55 const GURL& url, | 55 const GURL& url, |
| 56 const base::string16& name, | 56 const base::string16& name, |
| 57 const base::string16& content_security_policy, | 57 const base::string16& content_security_policy, |
| 58 blink::WebContentSecurityPolicyType security_policy_type, | 58 blink::WebContentSecurityPolicyType security_policy_type, |
| 59 bool pause_on_start, | 59 bool pause_on_start, |
| 60 int route_id) | 60 int route_id) |
| 61 : route_id_(route_id), name_(name), runing_(false), url_(url) { | 61 : route_id_(route_id), name_(name), runing_(false), url_(url) { |
| 62 RenderThreadImpl::current()->AddSharedWorkerRoute(route_id_, this); | 62 RenderThreadImpl::current()->AddEmbeddedWorkerRoute(route_id_, this); |
| 63 impl_ = blink::WebSharedWorker::create(this); | 63 impl_ = blink::WebSharedWorker::create(this); |
| 64 if (pause_on_start) { | 64 if (pause_on_start) { |
| 65 // Pause worker context when it starts and wait until either DevTools client | 65 // Pause worker context when it starts and wait until either DevTools client |
| 66 // is attached or explicit resume notification is received. | 66 // is attached or explicit resume notification is received. |
| 67 impl_->pauseWorkerContextOnStart(); | 67 impl_->pauseWorkerContextOnStart(); |
| 68 } | 68 } |
| 69 worker_devtools_agent_.reset( | 69 worker_devtools_agent_.reset( |
| 70 new SharedWorkerDevToolsAgent(route_id, impl_)); | 70 new SharedWorkerDevToolsAgent(route_id, impl_)); |
| 71 impl_->startWorkerContext(url, name_, | 71 impl_->startWorkerContext(url, name_, |
| 72 content_security_policy, security_policy_type); | 72 content_security_policy, security_policy_type); |
| 73 } | 73 } |
| 74 | 74 |
| 75 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { | 75 EmbeddedSharedWorkerStub::~EmbeddedSharedWorkerStub() { |
| 76 RenderThreadImpl::current()->RemoveSharedWorkerRoute(route_id_); | 76 RenderThreadImpl::current()->RemoveEmbeddedWorkerRoute(route_id_); |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool EmbeddedSharedWorkerStub::OnMessageReceived( | 79 bool EmbeddedSharedWorkerStub::OnMessageReceived( |
| 80 const IPC::Message& message) { | 80 const IPC::Message& message) { |
| 81 if (worker_devtools_agent_->OnMessageReceived(message)) | 81 if (worker_devtools_agent_->OnMessageReceived(message)) |
| 82 return true; | 82 return true; |
| 83 bool handled = true; | 83 bool handled = true; |
| 84 IPC_BEGIN_MESSAGE_MAP(EmbeddedSharedWorkerStub, message) | 84 IPC_BEGIN_MESSAGE_MAP(EmbeddedSharedWorkerStub, message) |
| 85 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, | 85 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, |
| 86 OnTerminateWorkerContext) | 86 OnTerminateWorkerContext) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 pending_channels_.push_back(channel); | 198 pending_channels_.push_back(channel); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { | 202 void EmbeddedSharedWorkerStub::OnTerminateWorkerContext() { |
| 203 runing_ = false; | 203 runing_ = false; |
| 204 impl_->terminateWorkerContext(); | 204 impl_->terminateWorkerContext(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace content | 207 } // namespace content |
| OLD | NEW |