diff options
Diffstat (limited to 'chromium/content/browser/message_port_message_filter.cc')
-rw-r--r-- | chromium/content/browser/message_port_message_filter.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/chromium/content/browser/message_port_message_filter.cc b/chromium/content/browser/message_port_message_filter.cc index 70d8175b503..ab3174bc8cc 100644 --- a/chromium/content/browser/message_port_message_filter.cc +++ b/chromium/content/browser/message_port_message_filter.cc @@ -11,7 +11,8 @@ namespace content { MessagePortMessageFilter::MessagePortMessageFilter( const NextRoutingIDCallback& callback) - : next_routing_id_(callback) { + : BrowserMessageFilter(MessagePortMsgStart), + next_routing_id_(callback) { } MessagePortMessageFilter::~MessagePortMessageFilter() { @@ -21,10 +22,9 @@ void MessagePortMessageFilter::OnChannelClosing() { MessagePortService::GetInstance()->OnMessagePortMessageFilterClosing(this); } -bool MessagePortMessageFilter::OnMessageReceived(const IPC::Message& message, - bool* message_was_ok) { +bool MessagePortMessageFilter::OnMessageReceived(const IPC::Message& message) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP_EX(MessagePortMessageFilter, message, *message_was_ok) + IPC_BEGIN_MESSAGE_MAP(MessagePortMessageFilter, message) IPC_MESSAGE_HANDLER(MessagePortHostMsg_CreateMessagePort, OnCreateMessagePort) IPC_MESSAGE_FORWARD(MessagePortHostMsg_DestroyMessagePort, @@ -43,7 +43,7 @@ bool MessagePortMessageFilter::OnMessageReceived(const IPC::Message& message, MessagePortService::GetInstance(), MessagePortService::SendQueuedMessages) IPC_MESSAGE_UNHANDLED(handled = false) - IPC_END_MESSAGE_MAP_EX() + IPC_END_MESSAGE_MAP() return handled; } @@ -56,6 +56,22 @@ int MessagePortMessageFilter::GetNextRoutingID() { return next_routing_id_.Run(); } +void MessagePortMessageFilter::UpdateMessagePortsWithNewRoutes( + const std::vector<int>& message_port_ids, + std::vector<int>* new_routing_ids) { + DCHECK(new_routing_ids); + new_routing_ids->clear(); + new_routing_ids->resize(message_port_ids.size()); + + for (size_t i = 0; i < message_port_ids.size(); ++i) { + (*new_routing_ids)[i] = GetNextRoutingID(); + MessagePortService::GetInstance()->UpdateMessagePort( + message_port_ids[i], + this, + (*new_routing_ids)[i]); + } +} + void MessagePortMessageFilter::OnCreateMessagePort(int *route_id, int* message_port_id) { *route_id = next_routing_id_.Run(); |