diff options
author | kalman <kalman@chromium.org> | 2015-07-10 17:01:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-11 00:03:23 +0000 |
commit | bd9f618ebc1989cade688046a7c0908a6bf82bb5 (patch) | |
tree | 83d5598a572938247b98c7452025d9c822a0b3c4 /extensions/renderer/event_bindings.h | |
parent | c58992cc880b5bff5813276ee9d20a79be70b31f (diff) | |
download | chromium_src-bd9f618ebc1989cade688046a7c0908a6bf82bb5.zip chromium_src-bd9f618ebc1989cade688046a7c0908a6bf82bb5.tar.gz chromium_src-bd9f618ebc1989cade688046a7c0908a6bf82bb5.tar.bz2 |
Clear an extension's filtered events when a context is destroyed.
In crrev.com/325156 I moved event invalidation logic from JavaScript into C++,
but I missed out filtered events. This CL also does some cleanup.
BUG=503913
R=rdevlin.cronin@chromium.org
Review URL: https://codereview.chromium.org/1227093008
Cr-Commit-Position: refs/heads/master@{#338403}
Diffstat (limited to 'extensions/renderer/event_bindings.h')
-rw-r--r-- | extensions/renderer/event_bindings.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/extensions/renderer/event_bindings.h b/extensions/renderer/event_bindings.h index cf06692..ad979fc 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 a normal event, a filtered event is + // identified by a unique ID per filter, not its name. + // |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); }; |