| 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/renderer/websharedworker_proxy.h" | 5 #include "chrome/renderer/websharedworker_proxy.h" |
| 6 | 6 |
| 7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/common/webmessageportchannel_impl.h" | 8 #include "chrome/common/webmessageportchannel_impl.h" |
| 9 #include "chrome/common/worker_messages.h" | 9 #include "chrome/common/worker_messages.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" | 10 #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 Send(new WorkerMsg_Connect(route_id_, message_port_id, MSG_ROUTING_NONE)); | 60 Send(new WorkerMsg_Connect(route_id_, message_port_id, MSG_ROUTING_NONE)); |
| 61 if (HasQueuedMessages()) { | 61 if (HasQueuedMessages()) { |
| 62 connect_listener_ = listener; | 62 connect_listener_ = listener; |
| 63 } else { | 63 } else { |
| 64 listener->connected(); | 64 listener->connected(); |
| 65 // The listener may free this object, so do not access the object after | 65 // The listener may free this object, so do not access the object after |
| 66 // this point. | 66 // this point. |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 void WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) { | 70 bool WebSharedWorkerProxy::OnMessageReceived(const IPC::Message& message) { |
| 71 bool handled = true; |
| 71 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerProxy, message) | 72 IPC_BEGIN_MESSAGE_MAP(WebSharedWorkerProxy, message) |
| 72 IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated) | 73 IPC_MESSAGE_HANDLER(ViewMsg_WorkerCreated, OnWorkerCreated) |
| 74 IPC_MESSAGE_UNHANDLED(handled = false) |
| 73 IPC_END_MESSAGE_MAP() | 75 IPC_END_MESSAGE_MAP() |
| 76 return handled; |
| 74 } | 77 } |
| 75 | 78 |
| 76 void WebSharedWorkerProxy::OnWorkerCreated() { | 79 void WebSharedWorkerProxy::OnWorkerCreated() { |
| 77 // The worker is created - now send off the CreateWorkerContext message and | 80 // The worker is created - now send off the CreateWorkerContext message and |
| 78 // any other queued messages | 81 // any other queued messages |
| 79 SendQueuedMessages(); | 82 SendQueuedMessages(); |
| 80 | 83 |
| 81 // Inform any listener that the pending connect event has been sent | 84 // Inform any listener that the pending connect event has been sent |
| 82 // (this can result in this object being freed). | 85 // (this can result in this object being freed). |
| 83 if (connect_listener_) { | 86 if (connect_listener_) { |
| 84 connect_listener_->connected(); | 87 connect_listener_->connected(); |
| 85 } | 88 } |
| 86 } | 89 } |
| OLD | NEW |