diff options
author | pneubeck <pneubeck@chromium.org> | 2015-09-11 02:03:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-11 09:03:34 +0000 |
commit | d9af1b4b16c1f2d9b46fa2fe3583f78e93923e4e (patch) | |
tree | fd7b0ec520709f3717317ce0329f4c225de264d0 /extensions/renderer/resources | |
parent | e9c78e73e271fe1b8f9dccf6edbe1e5e5aa8a880 (diff) | |
download | chromium_src-d9af1b4b16c1f2d9b46fa2fe3583f78e93923e4e.zip chromium_src-d9af1b4b16c1f2d9b46fa2fe3583f78e93923e4e.tar.gz chromium_src-d9af1b4b16c1f2d9b46fa2fe3583f78e93923e4e.tar.bz2 |
Simplify SendRequest of Extension API calls.
Before, the request id was fetched in a separate native call.
Now, the request id is returned by the startRequest function.
Review URL: https://codereview.chromium.org/1331063002
Cr-Commit-Position: refs/heads/master@{#348361}
Diffstat (limited to 'extensions/renderer/resources')
-rw-r--r-- | extensions/renderer/resources/send_request.js | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/extensions/renderer/resources/send_request.js b/extensions/renderer/resources/send_request.js index e042b01..3dc523c 100644 --- a/extensions/renderer/resources/send_request.js +++ b/extensions/renderer/resources/send_request.js @@ -109,8 +109,6 @@ function prepareRequest(args, argSchemas) { // |optArgs| is an object with optional parameters as follows: // - customCallback: a callback that should be called instead of the standard // callback. -// - nativeFunction: the v8 native function to handle the request, or -// StartRequest if missing. // - forIOThread: true if this function should be handled on the browser IO // thread. // - preserveNullInObjects: true if it is safe for null to be in objects. @@ -126,19 +124,12 @@ function sendRequest(functionName, args, argSchemas, optArgs) { request.customCallback = optArgs.customCallback; } - var nativeFunction = optArgs.nativeFunction || natives.StartRequest; - - var requestId = natives.GetNextRequestId(); + var hasCallback = request.callback || optArgs.customCallback; + var requestId = + natives.StartRequest(functionName, request.args, hasCallback, + optArgs.forIOThread, optArgs.preserveNullInObjects); request.id = requestId; requests[requestId] = request; - - var hasCallback = request.callback || optArgs.customCallback; - return nativeFunction(functionName, - request.args, - requestId, - hasCallback, - optArgs.forIOThread, - optArgs.preserveNullInObjects); } function getCalledSendRequest() { |