summaryrefslogtreecommitdiffstats
path: root/extensions/renderer/resources
diff options
context:
space:
mode:
authorpneubeck <pneubeck@chromium.org>2015-09-11 02:03:03 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-11 09:03:34 +0000
commitd9af1b4b16c1f2d9b46fa2fe3583f78e93923e4e (patch)
treefd7b0ec520709f3717317ce0329f4c225de264d0 /extensions/renderer/resources
parente9c78e73e271fe1b8f9dccf6edbe1e5e5aa8a880 (diff)
downloadchromium_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.js17
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() {