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

Unified Diff: extensions/renderer/event_emitter.h

Issue 2921013002: [Extensions Bindings] Return result from event dispatch (Closed)
Patch Set: add listener count todo Created 3 years, 6 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
« no previous file with comments | « extensions/renderer/api_event_handler_unittest.cc ('k') | extensions/renderer/event_emitter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/event_emitter.h
diff --git a/extensions/renderer/event_emitter.h b/extensions/renderer/event_emitter.h
index e843323bbfa63bb7a796298eee86c5bd66383d53..93190a3798a5c765e017f1d5cba02bc26fa8d2d3 100644
--- a/extensions/renderer/event_emitter.h
+++ b/extensions/renderer/event_emitter.h
@@ -26,7 +26,8 @@ class EventEmitter final : public gin::Wrappable<EventEmitter> {
public:
EventEmitter(bool supports_filters,
std::unique_ptr<APIEventListeners> listeners,
- const binding::RunJSFunction& run_js);
+ const binding::RunJSFunction& run_js,
+ const binding::RunJSFunctionSync& run_js_sync);
~EventEmitter() override;
static gin::WrapperInfo kWrapperInfo;
@@ -53,6 +54,15 @@ class EventEmitter final : public gin::Wrappable<EventEmitter> {
bool HasListeners();
void Dispatch(gin::Arguments* arguments);
+ // Notifies the listeners of an event with the given |args|. If |run_sync| is
+ // true, runs JS synchronously and populates |out_values| with the results of
+ // the listeners.
+ void DispatchImpl(v8::Local<v8::Context> context,
+ std::vector<v8::Local<v8::Value>>* args,
+ const EventFilteringInfo* filter,
+ bool run_sync,
+ std::vector<v8::Global<v8::Value>>* out_values);
+
// Whether or not this object is still valid; false upon context release.
// When invalid, no listeners can be added or removed.
bool valid_ = true;
@@ -63,6 +73,7 @@ class EventEmitter final : public gin::Wrappable<EventEmitter> {
std::unique_ptr<APIEventListeners> listeners_;
binding::RunJSFunction run_js_;
+ binding::RunJSFunctionSync run_js_sync_;
DISALLOW_COPY_AND_ASSIGN(EventEmitter);
};
« no previous file with comments | « extensions/renderer/api_event_handler_unittest.cc ('k') | extensions/renderer/event_emitter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698