Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1085)

Unified Diff: chrome/browser/extensions/extension_event_router.h

Issue 8343079: Don't close background pages if there is a pending response (callback). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only track in-flight events when lazy Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_event_router.h
diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h
index 55831ed7a1d35effb1aff643903fe0c1ec8d20e8..05931e89d41ed23c26930d73aa60e84345cc9a8c 100644
--- a/chrome/browser/extensions/extension_event_router.h
+++ b/chrome/browser/extensions/extension_event_router.h
@@ -88,6 +88,12 @@ class ExtensionEventRouter : public content::NotificationObserver {
const std::string& cross_incognito_args,
const GURL& event_url);
+ // Functions for tracking the number of events that have been dispatched and
+ // not yet ACKed by the renderer.
+ 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.
+ void DecrementInFlightEvents(const std::string& extension_id);
+ bool HasInFlightEvents(const std::string& extension_id);
+
protected:
// The details of an event to be dispatched.
struct ExtensionEvent;
@@ -132,6 +138,10 @@ class ExtensionEventRouter : public content::NotificationObserver {
linked_ptr<PendingEventsList> > PendingEventsPerExtMap;
PendingEventsPerExtMap pending_events_;
+ // Track of the number of dispatched events that have not yet sent an
+ // ACK from the renderer.
+ std::map<std::string, int> in_flight_events_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter);
};

Powered by Google App Engine
This is Rietveld 408576698