OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/worker/webworker_stub.h" | 5 #include "chrome/worker/webworker_stub.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/child_thread.h" | 8 #include "chrome/common/child_thread.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/file_system/file_system_dispatcher.h" | 10 #include "chrome/common/file_system/file_system_dispatcher.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 WebWorkerStub::~WebWorkerStub() { | 51 WebWorkerStub::~WebWorkerStub() { |
52 impl_->clientDestroyed(); | 52 impl_->clientDestroyed(); |
53 } | 53 } |
54 | 54 |
55 void WebWorkerStub::OnChannelError() { | 55 void WebWorkerStub::OnChannelError() { |
56 OnTerminateWorkerContext(); | 56 OnTerminateWorkerContext(); |
57 } | 57 } |
58 | 58 |
| 59 const GURL& WebWorkerStub::url() const { |
| 60 return url_; |
| 61 } |
| 62 |
59 void WebWorkerStub::OnMessageReceived(const IPC::Message& message) { | 63 void WebWorkerStub::OnMessageReceived(const IPC::Message& message) { |
60 if (!impl_) | 64 if (!impl_) |
61 return; | 65 return; |
62 | 66 |
63 IPC_BEGIN_MESSAGE_MAP(WebWorkerStub, message) | 67 IPC_BEGIN_MESSAGE_MAP(WebWorkerStub, message) |
64 IPC_MESSAGE_FORWARD(WorkerMsg_StartWorkerContext, impl_, | 68 IPC_MESSAGE_FORWARD(WorkerMsg_StartWorkerContext, impl_, |
65 WebWorker::startWorkerContext) | 69 WebWorker::startWorkerContext) |
66 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, | 70 IPC_MESSAGE_HANDLER(WorkerMsg_TerminateWorkerContext, |
67 OnTerminateWorkerContext) | 71 OnTerminateWorkerContext) |
68 IPC_MESSAGE_HANDLER(WorkerMsg_PostMessage, OnPostMessage) | 72 IPC_MESSAGE_HANDLER(WorkerMsg_PostMessage, OnPostMessage) |
(...skipping 14 matching lines...) Expand all Loading... |
83 const std::vector<int>& sent_message_port_ids, | 87 const std::vector<int>& sent_message_port_ids, |
84 const std::vector<int>& new_routing_ids) { | 88 const std::vector<int>& new_routing_ids) { |
85 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); | 89 WebKit::WebMessagePortChannelArray channels(sent_message_port_ids.size()); |
86 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { | 90 for (size_t i = 0; i < sent_message_port_ids.size(); i++) { |
87 channels[i] = new WebMessagePortChannelImpl( | 91 channels[i] = new WebMessagePortChannelImpl( |
88 new_routing_ids[i], sent_message_port_ids[i]); | 92 new_routing_ids[i], sent_message_port_ids[i]); |
89 } | 93 } |
90 | 94 |
91 impl_->postMessageToWorkerContext(message, channels); | 95 impl_->postMessageToWorkerContext(message, channels); |
92 } | 96 } |
OLD | NEW |