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

Unified Diff: extensions/renderer/js_extension_bindings_system.cc

Issue 2924683002: [Extensions Bindings] Avoid passing the event filter to JS (Closed)
Patch Set: rebase 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/event_bindings.cc ('k') | extensions/renderer/resources/event.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/js_extension_bindings_system.cc
diff --git a/extensions/renderer/js_extension_bindings_system.cc b/extensions/renderer/js_extension_bindings_system.cc
index 4506928738734248354349d1cae178ffb03348b7..f2bcc96d855071b047e230dace2be39ad55de17e 100644
--- a/extensions/renderer/js_extension_bindings_system.cc
+++ b/extensions/renderer/js_extension_bindings_system.cc
@@ -28,8 +28,6 @@ namespace extensions {
namespace {
-static const char kEventDispatchFunction[] = "dispatchEvent";
-
// Gets |field| from |object| or creates it as an empty object if it doesn't
// exist.
v8::Local<v8::Object> GetOrCreateObject(const v8::Local<v8::Object>& object,
@@ -252,26 +250,8 @@ void JsExtensionBindingsSystem::DispatchEventInContext(
const base::ListValue* event_args,
const base::DictionaryValue* filtering_info,
ScriptContext* context) {
- v8::HandleScope handle_scope(context->isolate());
- v8::Context::Scope context_scope(context->v8_context());
-
- std::vector<v8::Local<v8::Value>> arguments;
- arguments.push_back(gin::StringToSymbol(context->isolate(), event_name));
-
- {
- std::unique_ptr<content::V8ValueConverter> converter(
- content::V8ValueConverter::create());
- arguments.push_back(
- converter->ToV8Value(event_args, context->v8_context()));
- if (filtering_info && !filtering_info->empty()) {
- arguments.push_back(
- converter->ToV8Value(filtering_info, context->v8_context()));
- }
- }
-
- context->module_system()->CallModuleMethodSafe(
- kEventBindings, kEventDispatchFunction, arguments.size(),
- arguments.data());
+ EventBindings::DispatchEventInContext(event_name, event_args, filtering_info,
+ context);
}
bool JsExtensionBindingsSystem::HasEventListenerInContext(
« no previous file with comments | « extensions/renderer/event_bindings.cc ('k') | extensions/renderer/resources/event.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698