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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 ResourceMessageFilter* source); | 127 ResourceMessageFilter* source); |
128 | 128 |
129 private: | 129 private: |
130 // A map of channel ID to its channel object. | 130 // A map of channel ID to its channel object. |
131 typedef std::map<int, linked_ptr<MessageChannel> > MessageChannelMap; | 131 typedef std::map<int, linked_ptr<MessageChannel> > MessageChannelMap; |
132 | 132 |
133 // Allocates a pair of port ids. | 133 // Allocates a pair of port ids. |
134 // NOTE: this can be called from any thread. | 134 // NOTE: this can be called from any thread. |
135 void AllocatePortIdPair(int* port1, int* port2); | 135 void AllocatePortIdPair(int* port1, int* port2); |
136 | 136 |
137 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, int port_id); | 137 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, int port_id, |
| 138 bool notify_other_port); |
138 | 139 |
139 // The UI message loop, used for posting tasks. | 140 // The UI message loop, used for posting tasks. |
140 MessageLoop* ui_loop_; | 141 MessageLoop* ui_loop_; |
141 | 142 |
142 // --- UI thread only: | 143 // --- UI thread only: |
143 | 144 |
144 // Handles channel creation and notifies the destinations that a channel was | 145 // Handles channel creation and notifies the destinations that a channel was |
145 // opened. | 146 // opened. |
146 void OpenChannelToExtensionOnUIThread( | 147 void OpenChannelToExtensionOnUIThread( |
147 int source_process_id, int source_routing_id, int receiver_port_id, | 148 int source_process_id, int source_routing_id, int receiver_port_id, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 int next_port_id_; | 186 int next_port_id_; |
186 | 187 |
187 // Protects the next_port_id_ variable, since it can be | 188 // Protects the next_port_id_ variable, since it can be |
188 // used on the IO thread or the UI thread. | 189 // used on the IO thread or the UI thread. |
189 Lock next_port_id_lock_; | 190 Lock next_port_id_lock_; |
190 | 191 |
191 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); | 192 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); |
192 }; | 193 }; |
193 | 194 |
194 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 195 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
OLD | NEW |