From a51f18c04d28b77e7cc2728c0cb85a2b2998ef54 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 2 Apr 2016 06:51:56 +0100 Subject: Use port for frame-to-background messages. Without considering the size of the data passed, ports seem to be about 5 times fast than sendMessage(), so we use ports of link-hint messages wherever possible. --- content_scripts/link_hints.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'content_scripts') diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index af29b435..d22657ad 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -53,7 +53,9 @@ HintCoordinator = onExit: [] sendMessage: (messageType, request = {}) -> - chrome.runtime.sendMessage extend request, {handler: "linkHintsMessage", messageType, frameId} + # We use Frame.postMessage() (instead of chrome.runtime.sendMessage()) because that seems to be + # considerable faster, by about a factor of 5. + Frame.postMessage "linkHintsMessage", extend request, {messageType} prepareToActivateMode: (mode, onExit) -> # We need to communicate with the background page (and other frames) to initiate link-hints mode. To -- cgit v1.2.3