Extension Bindings: Add support for specifying IOThread extension functions in schemas.
Currently, to write an IOThreadExtensionFunction, one has to write custom
bindings for the function. This CL adds support for "forIOThread" parameter in a
function's schema. If this parameter is true, the function is executed on the
IO thread. This removes the need to use custom bindings. Support for the same is
added for both JS and native bindings.
Review-Url: https://codereview.chromium.org/2917233002
Cr-Commit-Position: refs/heads/master@{#477384}
diff --git a/extensions/renderer/resources/web_request_custom_bindings.js b/extensions/renderer/resources/web_request_custom_bindings.js
index 0befc670..1ebd0d0 100644
--- a/extensions/renderer/resources/web_request_custom_bindings.js
+++ b/extensions/renderer/resources/web_request_custom_bindings.js
@@ -4,22 +4,8 @@
// Custom binding for the webRequest API.
-var binding = apiBridge || require('binding').Binding.create('webRequest');
-var sendRequest = bindingUtil ?
- $Function.bind(bindingUtil.sendRequest, bindingUtil) :
- require('sendRequest').sendRequest;
-
-binding.registerCustomHook(function(api) {
- var apiFunctions = api.apiFunctions;
-
- apiFunctions.setHandleRequest('handlerBehaviorChanged', function() {
- var args = $Array.slice(arguments);
- sendRequest(this.name, args, this.definition.parameters,
- {__proto__: null, forIOThread: true});
- });
-});
-
if (!apiBridge) {
+ var binding = require('binding').Binding.create('webRequest');
var webRequestEvent = require('webRequestEvent').WebRequestEvent;
binding.registerCustomEvent(webRequestEvent);
exports.$set('binding', binding.generate());