Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 // If |cross_incognito_profile| is non-NULL and different from | 81 // If |cross_incognito_profile| is non-NULL and different from |
| 82 // restrict_to_profile, send the event with cross_incognito_args to the | 82 // restrict_to_profile, send the event with cross_incognito_args to the |
| 83 // extensions in that profile that can't cross incognito. | 83 // extensions in that profile that can't cross incognito. |
| 84 void DispatchEventsToRenderersAcrossIncognito( | 84 void DispatchEventsToRenderersAcrossIncognito( |
| 85 const std::string& event_name, | 85 const std::string& event_name, |
| 86 const std::string& event_args, | 86 const std::string& event_args, |
| 87 Profile* restrict_to_profile, | 87 Profile* restrict_to_profile, |
| 88 const std::string& cross_incognito_args, | 88 const std::string& cross_incognito_args, |
| 89 const GURL& event_url); | 89 const GURL& event_url); |
| 90 | 90 |
| 91 // Functions for tracking the number of events that have been dispatched and | |
| 92 // not yet ACKed by the renderer. | |
| 93 void IncrementInFlightEvents(const std::string& extension_id); | |
|
Aaron Boodman
2011/10/31 17:46:08
Looks like Increment does not need to be public.
Tessa MacDuff
2011/10/31 19:01:29
Done.
| |
| 94 void DecrementInFlightEvents(const std::string& extension_id); | |
| 95 bool HasInFlightEvents(const std::string& extension_id); | |
| 96 | |
| 91 protected: | 97 protected: |
| 92 // The details of an event to be dispatched. | 98 // The details of an event to be dispatched. |
| 93 struct ExtensionEvent; | 99 struct ExtensionEvent; |
| 94 | 100 |
| 95 // Shared by DispatchEvent*. If |extension_id| is empty, the event is | 101 // Shared by DispatchEvent*. If |extension_id| is empty, the event is |
| 96 // broadcast. | 102 // broadcast. |
| 97 // An event that just came off the pending list may not be delayed again. | 103 // An event that just came off the pending list may not be delayed again. |
| 98 void DispatchEventImpl(const linked_ptr<ExtensionEvent>& event, | 104 void DispatchEventImpl(const linked_ptr<ExtensionEvent>& event, |
| 99 bool was_pending); | 105 bool was_pending); |
| 100 | 106 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 125 typedef std::map<std::string, std::set<EventListener> > ListenerMap; | 131 typedef std::map<std::string, std::set<EventListener> > ListenerMap; |
| 126 ListenerMap listeners_; | 132 ListenerMap listeners_; |
| 127 | 133 |
| 128 // A map between an extension id and the queue of events pending | 134 // A map between an extension id and the queue of events pending |
| 129 // the load of it's background page. | 135 // the load of it's background page. |
| 130 typedef std::vector<linked_ptr<ExtensionEvent> > PendingEventsList; | 136 typedef std::vector<linked_ptr<ExtensionEvent> > PendingEventsList; |
| 131 typedef std::map<std::string, | 137 typedef std::map<std::string, |
| 132 linked_ptr<PendingEventsList> > PendingEventsPerExtMap; | 138 linked_ptr<PendingEventsList> > PendingEventsPerExtMap; |
| 133 PendingEventsPerExtMap pending_events_; | 139 PendingEventsPerExtMap pending_events_; |
| 134 | 140 |
| 141 // Track of the number of dispatched events that have not yet sent an | |
| 142 // ACK from the renderer. | |
| 143 std::map<std::string, int> in_flight_events_; | |
| 144 | |
| 135 DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter); | 145 DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter); |
| 136 }; | 146 }; |
| 137 | 147 |
| 138 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ | 148 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ |
| OLD | NEW |