| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 // --- UI thread only: | 134 // --- UI thread only: |
| 135 | 135 |
| 136 // UI-thread specific initialization. Does nothing if called more than once. | 136 // UI-thread specific initialization. Does nothing if called more than once. |
| 137 void Init(); | 137 void Init(); |
| 138 | 138 |
| 139 // Handles channel creation and notifies the destination that a channel was | 139 // Handles channel creation and notifies the destination that a channel was |
| 140 // opened. | 140 // opened. |
| 141 void OpenChannelOnUIThread(int source_routing_id, | 141 void OpenChannelOnUIThread(int source_routing_id, |
| 142 int source_port_id, int source_process_id, | 142 int source_port_id, int source_process_id, |
| 143 int dest_port_id, int dest_process_id); | 143 int dest_port_id, int dest_process_id, |
| 144 const std::string& extension_id); |
| 144 | 145 |
| 145 // Common between OpenChannelOnUIThread and | 146 // Common between OpenChannelOnUIThread and |
| 146 // OpenAutomationChannelToExtension. | 147 // OpenAutomationChannelToExtension. |
| 147 void OpenChannelOnUIThreadImpl( | 148 void OpenChannelOnUIThreadImpl( |
| 148 int source_routing_id, int source_port_id, IPC::Message::Sender* source, | 149 int source_routing_id, int source_port_id, int source_process_id, |
| 149 int dest_port_id, int dest_process_id, int source_process_id); | 150 IPC::Message::Sender* source, int dest_port_id, int dest_process_id, |
| 151 const std::string& extension_id); |
| 150 | 152 |
| 151 MessageChannelMap channels_; | 153 MessageChannelMap channels_; |
| 152 | 154 |
| 153 // True if Init has been called. | 155 // True if Init has been called. |
| 154 bool initialized_; | 156 bool initialized_; |
| 155 | 157 |
| 156 // For generating unique channel IDs. | 158 // For generating unique channel IDs. |
| 157 int next_port_id_; | 159 int next_port_id_; |
| 158 | 160 |
| 159 // Protects the next_port_id_ variable, since it can be | 161 // Protects the next_port_id_ variable, since it can be |
| 160 // used on the IO thread or the UI thread. | 162 // used on the IO thread or the UI thread. |
| 161 Lock next_port_id_lock_; | 163 Lock next_port_id_lock_; |
| 162 | 164 |
| 163 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); | 165 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); |
| 164 }; | 166 }; |
| 165 | 167 |
| 166 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 168 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
| OLD | NEW |