| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // A map of channel ID to its channel object. | 132 // A map of channel ID to its channel object. |
| 133 typedef std::map<int, linked_ptr<MessageChannel> > MessageChannelMap; | 133 typedef std::map<int, linked_ptr<MessageChannel> > MessageChannelMap; |
| 134 | 134 |
| 135 // Allocates a pair of port ids. | 135 // Allocates a pair of port ids. |
| 136 // NOTE: this can be called from any thread. | 136 // NOTE: this can be called from any thread. |
| 137 void AllocatePortIdPair(int* port1, int* port2); | 137 void AllocatePortIdPair(int* port1, int* port2); |
| 138 | 138 |
| 139 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, int port_id, | 139 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, int port_id, |
| 140 bool notify_other_port); | 140 bool notify_other_port); |
| 141 | 141 |
| 142 // The UI message loop, used for posting tasks. | |
| 143 MessageLoop* ui_loop_; | |
| 144 | |
| 145 // --- UI thread only: | 142 // --- UI thread only: |
| 146 | 143 |
| 147 // Handles channel creation and notifies the destinations that a channel was | 144 // Handles channel creation and notifies the destinations that a channel was |
| 148 // opened. | 145 // opened. |
| 149 void OpenChannelToExtensionOnUIThread( | 146 void OpenChannelToExtensionOnUIThread( |
| 150 int source_process_id, int source_routing_id, int receiver_port_id, | 147 int source_process_id, int source_routing_id, int receiver_port_id, |
| 151 const std::string& source_extension_id, | 148 const std::string& source_extension_id, |
| 152 const std::string& target_extension_id, | 149 const std::string& target_extension_id, |
| 153 const std::string& channel_name); | 150 const std::string& channel_name); |
| 154 | 151 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 int next_port_id_; | 189 int next_port_id_; |
| 193 | 190 |
| 194 // Protects the next_port_id_ variable, since it can be | 191 // Protects the next_port_id_ variable, since it can be |
| 195 // used on the IO thread or the UI thread. | 192 // used on the IO thread or the UI thread. |
| 196 Lock next_port_id_lock_; | 193 Lock next_port_id_lock_; |
| 197 | 194 |
| 198 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); | 195 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); |
| 199 }; | 196 }; |
| 200 | 197 |
| 201 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 198 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
| OLD | NEW |