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_service.h" | 5 #include "content/browser/message_port_service.h" |
6 | 6 |
7 #include "content/browser/message_port_message_filter.h" | 7 #include "content/browser/message_port_message_filter.h" |
8 #include "content/common/message_port_messages.h" | 8 #include "content/common/message_port_messages.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 MessagePorts::iterator cur_item = iter++; | 64 MessagePorts::iterator cur_item = iter++; |
65 if (cur_item->second.filter == filter) { | 65 if (cur_item->second.filter == filter) { |
66 Erase(cur_item->first); | 66 Erase(cur_item->first); |
67 } | 67 } |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void MessagePortService::Create(int route_id, | 71 void MessagePortService::Create(int route_id, |
72 MessagePortMessageFilter* filter, | 72 MessagePortMessageFilter* filter, |
73 int* message_port_id) { | 73 int* message_port_id) { |
| 74 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
74 *message_port_id = ++next_message_port_id_; | 75 *message_port_id = ++next_message_port_id_; |
75 | 76 |
76 MessagePort port; | 77 MessagePort port; |
77 port.filter = filter; | 78 port.filter = filter; |
78 port.route_id = route_id; | 79 port.route_id = route_id; |
79 port.message_port_id = *message_port_id; | 80 port.message_port_id = *message_port_id; |
80 port.entangled_message_port_id = MSG_ROUTING_NONE; | 81 port.entangled_message_port_id = MSG_ROUTING_NONE; |
81 port.queue_messages = false; | 82 port.queue_messages = false; |
82 message_ports_[*message_port_id] = port; | 83 message_ports_[*message_port_id] = port; |
83 } | 84 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Do the disentanglement (and be paranoid about the other side existing | 237 // Do the disentanglement (and be paranoid about the other side existing |
237 // just in case something unusual happened during entanglement). | 238 // just in case something unusual happened during entanglement). |
238 if (message_ports_.count(entangled_id)) { | 239 if (message_ports_.count(entangled_id)) { |
239 message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; | 240 message_ports_[entangled_id].entangled_message_port_id = MSG_ROUTING_NONE; |
240 } | 241 } |
241 } | 242 } |
242 message_ports_.erase(erase_item); | 243 message_ports_.erase(erase_item); |
243 } | 244 } |
244 | 245 |
245 } // namespace content | 246 } // namespace content |
OLD | NEW |