OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/message_port_message_filter.h" | 5 #include "content/browser/message_port_message_filter.h" |
6 | 6 |
7 #include "content/browser/message_port_service.h" | 7 #include "content/browser/message_port_service.h" |
8 #include "content/common/message_port_messages.h" | 8 #include "content/common/message_port_messages.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 void MessagePortMessageFilter::OnDestruct() const { | 55 void MessagePortMessageFilter::OnDestruct() const { |
56 BrowserThread::DeleteOnIOThread::Destruct(this); | 56 BrowserThread::DeleteOnIOThread::Destruct(this); |
57 } | 57 } |
58 | 58 |
59 int MessagePortMessageFilter::GetNextRoutingID() { | 59 int MessagePortMessageFilter::GetNextRoutingID() { |
60 return next_routing_id_.Run(); | 60 return next_routing_id_.Run(); |
61 } | 61 } |
62 | 62 |
63 void MessagePortMessageFilter::SendMessage( | 63 void MessagePortMessageFilter::SendMessage( |
64 int route_id, | 64 int route_id, |
65 const base::string16& message, | 65 const MessagePortMessage& message, |
66 const std::vector<int>& sent_message_port_ids) { | 66 const std::vector<int>& sent_message_port_ids) { |
67 // Generate new routing ids for all ports that were sent around. This avoids | 67 // Generate new routing ids for all ports that were sent around. This avoids |
68 // waiting for the created ports to send a sync message back to get routing | 68 // waiting for the created ports to send a sync message back to get routing |
69 // ids. | 69 // ids. |
70 std::vector<int> new_routing_ids; | 70 std::vector<int> new_routing_ids; |
71 UpdateMessagePortsWithNewRoutes(sent_message_port_ids, &new_routing_ids); | 71 UpdateMessagePortsWithNewRoutes(sent_message_port_ids, &new_routing_ids); |
72 Send(new MessagePortMsg_Message(route_id, message, sent_message_port_ids, | 72 Send(new MessagePortMsg_Message(route_id, message, sent_message_port_ids, |
73 new_routing_ids)); | 73 new_routing_ids)); |
74 } | 74 } |
75 | 75 |
(...skipping 27 matching lines...) Expand all Loading... |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 void MessagePortMessageFilter::OnCreateMessagePort(int *route_id, | 106 void MessagePortMessageFilter::OnCreateMessagePort(int *route_id, |
107 int* message_port_id) { | 107 int* message_port_id) { |
108 *route_id = next_routing_id_.Run(); | 108 *route_id = next_routing_id_.Run(); |
109 MessagePortService::GetInstance()->Create(*route_id, this, message_port_id); | 109 MessagePortService::GetInstance()->Create(*route_id, this, message_port_id); |
110 } | 110 } |
111 | 111 |
112 } // namespace content | 112 } // namespace content |
OLD | NEW |