| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/worker/webworker_stub.h" | 5 #include "content/worker/webworker_stub.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "content/common/child_thread.h" | 8 #include "content/common/child_thread.h" |
| 9 #include "content/common/content_client.h" | 9 #include "content/common/content_client.h" |
| 10 #include "content/common/file_system/file_system_dispatcher.h" | 10 #include "content/common/file_system/file_system_dispatcher.h" |
| 11 #include "content/common/webmessageportchannel_impl.h" | 11 #include "content/common/webmessageportchannel_impl.h" |
| 12 #include "content/common/worker_messages.h" | 12 #include "content/common/worker_messages.h" |
| 13 #include "content/worker/worker_devtools_agent.h" | 13 #include "content/worker/worker_devtools_agent.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" |
| 17 | 17 |
| 18 using WebKit::WebWorker; | 18 using WebKit::WebWorker; |
| 19 | 19 |
| 20 WebWorkerStub::WebWorkerStub(const GURL& url, int route_id, | 20 WebWorkerStub::WebWorkerStub(const GURL& url, int route_id, |
| 21 const WorkerAppCacheInitInfo& appcache_init_info) | 21 const WorkerAppCacheInitInfo& appcache_init_info) |
| 22 : WebWorkerStubBase(route_id, appcache_init_info), | 22 : WebWorkerStubBase(route_id, appcache_init_info), |
| 23 ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::create(client()))), | 23 ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::create(client()))), |
| 24 url_(url), | 24 url_(url), |
| 25 ALLOW_THIS_IN_INITIALIZER_LIST(worker_devtools_agent_( | 25 ALLOW_THIS_IN_INITIALIZER_LIST(worker_devtools_agent_( |
| 26 new WorkerDevToolsAgent(route_id, impl_))) { | 26 WorkerDevToolsAgent::CreateForDedicatedWorker(route_id, impl_))) { |
| 27 client()->set_devtools_agent(worker_devtools_agent_.get()); | 27 client()->set_devtools_agent(worker_devtools_agent_.get()); |
| 28 } | 28 } |
| 29 | 29 |
| 30 WebWorkerStub::~WebWorkerStub() { | 30 WebWorkerStub::~WebWorkerStub() { |
| 31 impl_->clientDestroyed(); | 31 impl_->clientDestroyed(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void WebWorkerStub::OnChannelError() { | 34 void WebWorkerStub::OnChannelError() { |
| 35 OnTerminateWorkerContext(); | 35 OnTerminateWorkerContext(); |
| 36 } | 36 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const std::vector<int>& sent_message_port_ids, | 72 const std::vector<int>& sent_message_port_ids, |
| 73 const std::vector<int>& new_routing_ids) { | 73 const std::vector<int>& new_routing_ids) { |
| 74 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); | 74 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); |
| 75 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { | 75 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { |
| 76 channels[i] = new WebMessagePortChannelImpl( | 76 channels[i] = new WebMessagePortChannelImpl( |
| 77 new_routing_ids[i], sent_message_port_ids[i]); | 77 new_routing_ids[i], sent_message_port_ids[i]); |
| 78 } | 78 } |
| 79 | 79 |
| 80 impl_->postMessageToWorkerContext(message, channels); | 80 impl_->postMessageToWorkerContext(message, channels); |
| 81 } | 81 } |
| OLD | NEW |