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

Unified Diff: extensions/renderer/event_bindings.h

Issue 1227093008: Clear an extension's filtered events when a context is destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments, rebase Created 5 years, 5 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: extensions/renderer/event_bindings.h
diff --git a/extensions/renderer/event_bindings.h b/extensions/renderer/event_bindings.h
index cf06692c3bb800226d9f633778315874f5bdec61..900962fd00b4fef05807fcb04dfcf7ce265cf275 100644
--- a/extensions/renderer/event_bindings.h
+++ b/extensions/renderer/event_bindings.h
@@ -53,23 +53,32 @@ class EventBindings : public ObjectBackedNativeHandler {
// to MatchAgainstEventFilter where this listener matches.
void AttachFilteredEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
+ // JavaScript handler which forwards to DetachFilteredEvent.
// void DetachFilteredEvent(int id, bool manual)
- // id - Id of the event to detach.
- // manual - false if this is part of the extension unload process where all
- // listeners are automatically detached.
- void DetachFilteredEvent(const v8::FunctionCallbackInfo<v8::Value>& args);
+ // args[0] forwards to |matcher_id|
+ // args[1] forwards to |is_manual|
+ void DetachFilteredEventHandler(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ // Detaches a filtered event. Unlike normal events, filtered events are
+ // identified by an ID, not its name.
Devlin 2015/07/10 20:44:34 nitty nit: "not their names" or "a filtered event
not at google - send to devlin 2015/07/10 20:53:39 Done.
+ // |matcher_id| The ID of the filtered event.
+ // |is_manual| false if this is part of the extension unload process where all
+ // listeners are automatically detached.
+ void DetachFilteredEvent(int matcher_id, bool is_manual);
void MatchAgainstEventFilter(const v8::FunctionCallbackInfo<v8::Value>& args);
scoped_ptr<EventMatcher> ParseEventMatcher(
- base::DictionaryValue* filter_dict);
+ scoped_ptr<base::DictionaryValue> filter);
// Called when our context, and therefore us, is invalidated. Run any cleanup.
void OnInvalidated();
- // The set of attached events. Maintain this so that we can detch them on
- // unload.
+ // The set of attached events and filtered events. Maintain these so that we
+ // can detch them on unload.
std::set<std::string> attached_event_names_;
+ std::set<int> attached_matcher_ids_;
DISALLOW_COPY_AND_ASSIGN(EventBindings);
};
« no previous file with comments | « chrome/test/data/extensions/api_test/events_are_unregistered/page1.js ('k') | extensions/renderer/event_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698