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" | |
13 #include "base/lock.h" | 12 #include "base/lock.h" |
14 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
15 #include "chrome/common/notification_registrar.h" | 14 #include "chrome/common/notification_registrar.h" |
16 #include "chrome/browser/extensions/extension_devtools_manager.h" | 15 #include "chrome/browser/extensions/extension_devtools_manager.h" |
17 #include "ipc/ipc_message.h" | 16 #include "ipc/ipc_message.h" |
18 | 17 |
19 class MessageLoop; | 18 class MessageLoop; |
20 class Profile; | 19 class Profile; |
21 class RenderProcessHost; | 20 class RenderProcessHost; |
22 class ResourceMessageFilter; | 21 class ResourceMessageFilter; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 // Same as above, but opens a channel to the tab with the given ID. Messages | 122 // Same as above, but opens a channel to the tab with the given ID. Messages |
124 // are restricted to that tab, so if there are multiple tabs in that process, | 123 // are restricted to that tab, so if there are multiple tabs in that process, |
125 // only the targeted tab will receive messages. | 124 // only the targeted tab will receive messages. |
126 int OpenChannelToTab(int routing_id, int tab_id, | 125 int OpenChannelToTab(int routing_id, int tab_id, |
127 const std::string& extension_id, | 126 const std::string& extension_id, |
128 const std::string& channel_name, | 127 const std::string& channel_name, |
129 ResourceMessageFilter* source); | 128 ResourceMessageFilter* source); |
130 | 129 |
131 private: | 130 private: |
132 // A map of channel ID to its channel object. | 131 // A map of channel ID to its channel object. |
133 typedef std::map<int, linked_ptr<MessageChannel> > MessageChannelMap; | 132 typedef std::map<int, MessageChannel*> MessageChannelMap; |
Erik does not do reviews
2009/11/04 17:00:33
I think I'm missing something about the change awa
Matt Perry
2009/11/04 18:47:47
Yes, theoretically. This is the "grasping at straw
| |
134 | 133 |
135 // Allocates a pair of port ids. | 134 // Allocates a pair of port ids. |
136 // NOTE: this can be called from any thread. | 135 // NOTE: this can be called from any thread. |
137 void AllocatePortIdPair(int* port1, int* port2); | 136 void AllocatePortIdPair(int* port1, int* port2); |
138 | 137 |
139 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, int port_id, | 138 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, int port_id, |
140 bool notify_other_port); | 139 bool notify_other_port); |
141 | 140 |
142 // --- UI thread only: | 141 // --- UI thread only: |
143 | 142 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
189 int next_port_id_; | 188 int next_port_id_; |
190 | 189 |
191 // Protects the next_port_id_ variable, since it can be | 190 // Protects the next_port_id_ variable, since it can be |
192 // used on the IO thread or the UI thread. | 191 // used on the IO thread or the UI thread. |
193 Lock next_port_id_lock_; | 192 Lock next_port_id_lock_; |
194 | 193 |
195 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); | 194 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); |
196 }; | 195 }; |
197 | 196 |
198 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 197 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
OLD | NEW |