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/WebMessagePortChannel
.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" |
17 | 18 |
18 using WebKit::WebWorker; | 19 using WebKit::WebWorker; |
19 | 20 |
20 WebWorkerStub::WebWorkerStub(const GURL& url, int route_id, | 21 WebWorkerStub::WebWorkerStub(const GURL& url, int route_id, |
21 const WorkerAppCacheInitInfo& appcache_init_info) | 22 const WorkerAppCacheInitInfo& appcache_init_info) |
22 : WebWorkerStubBase(route_id, appcache_init_info), | 23 : WebWorkerStubBase(route_id, appcache_init_info), |
23 ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::create(client()))), | 24 ALLOW_THIS_IN_INITIALIZER_LIST(impl_(WebWorker::create(client()))), |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 impl_->terminateWorkerContext(); | 65 impl_->terminateWorkerContext(); |
65 | 66 |
66 // Call the client to make sure context exits. | 67 // Call the client to make sure context exits. |
67 EnsureWorkerContextTerminates(); | 68 EnsureWorkerContextTerminates(); |
68 } | 69 } |
69 | 70 |
70 void WebWorkerStub::OnPostMessage( | 71 void WebWorkerStub::OnPostMessage( |
71 const string16& message, | 72 const string16& message, |
72 const std::vector<int>& sent_message_port_ids, | 73 const std::vector<int>& sent_message_port_ids, |
73 const std::vector<int>& new_routing_ids) { | 74 const std::vector<int>& new_routing_ids) { |
74 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); | 75 WebKit::WebTransferableReceiptArray receipts(sent_message_port_ids.size()); |
75 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { | 76 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { |
76 channels[i] = new WebMessagePortChannelImpl( | 77 WebMessagePortChannelImpl* impl = new WebMessagePortChannelImpl( |
77 new_routing_ids[i], sent_message_port_ids[i]); | 78 new_routing_ids[i], sent_message_port_ids[i]); |
| 79 #ifndef WebTransferableReceipt_h |
| 80 receipts[i] = impl; |
| 81 #else |
| 82 receipts[i] = new WebKit::WebMessagePortReceipt(impl); |
| 83 #endif |
78 } | 84 } |
79 | 85 |
80 impl_->postMessageToWorkerContext(message, channels); | 86 impl_->postMessageToWorkerContext(message, receipts); |
| 87 |
| 88 #ifdef WebTransferableReceipt_h |
| 89 for (size_t i = 0; i < receipts.size(); ++i) { |
| 90 delete receipts[i]; |
| 91 receipts[i] = 0; |
| 92 } |
| 93 #endif |
81 } | 94 } |
OLD | NEW |