| 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> |
| 11 | 11 |
| 12 #include "base/linked_ptr.h" | 12 #include "base/linked_ptr.h" |
| 13 #include "base/lock.h" | 13 #include "base/lock.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "chrome/common/notification_registrar.h" | 15 #include "chrome/common/notification_registrar.h" |
| 16 #include "chrome/browser/extensions/extension_devtools_manager.h" |
| 16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
| 17 | 18 |
| 18 class MessageLoop; | 19 class MessageLoop; |
| 19 class Profile; | 20 class Profile; |
| 20 class RenderProcessHost; | 21 class RenderProcessHost; |
| 21 class ResourceMessageFilter; | 22 class ResourceMessageFilter; |
| 22 class URLRequestContext; | 23 class URLRequestContext; |
| 23 | 24 |
| 24 // This class manages message and event passing between renderer processes. | 25 // This class manages message and event passing between renderer processes. |
| 25 // It maintains a list of processes that are listening to events and a set of | 26 // It maintains a list of processes that are listening to events and a set of |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 151 |
| 151 // An IPC sender that might be in our list of channels has closed. | 152 // An IPC sender that might be in our list of channels has closed. |
| 152 void OnSenderClosed(IPC::Message::Sender* sender); | 153 void OnSenderClosed(IPC::Message::Sender* sender); |
| 153 | 154 |
| 154 Profile* profile_; | 155 Profile* profile_; |
| 155 | 156 |
| 156 NotificationRegistrar registrar_; | 157 NotificationRegistrar registrar_; |
| 157 | 158 |
| 158 MessageChannelMap channels_; | 159 MessageChannelMap channels_; |
| 159 | 160 |
| 161 scoped_refptr<ExtensionDevToolsManager> extension_devtools_manager_; |
| 162 |
| 160 // A map between an event name and a set of process id's that are listening | 163 // A map between an event name and a set of process id's that are listening |
| 161 // to that event. | 164 // to that event. |
| 162 typedef std::map<std::string, std::set<int> > ListenerMap; | 165 typedef std::map<std::string, std::set<int> > ListenerMap; |
| 163 ListenerMap listeners_; | 166 ListenerMap listeners_; |
| 164 | 167 |
| 165 // --- UI or IO thread: | 168 // --- UI or IO thread: |
| 166 | 169 |
| 167 // For generating unique channel IDs. | 170 // For generating unique channel IDs. |
| 168 int next_port_id_; | 171 int next_port_id_; |
| 169 | 172 |
| 170 // Protects the next_port_id_ variable, since it can be | 173 // Protects the next_port_id_ variable, since it can be |
| 171 // used on the IO thread or the UI thread. | 174 // used on the IO thread or the UI thread. |
| 172 Lock next_port_id_lock_; | 175 Lock next_port_id_lock_; |
| 173 | 176 |
| 174 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); | 177 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); |
| 175 }; | 178 }; |
| 176 | 179 |
| 177 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 180 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
| OLD | NEW |