diff options
| author | Stephen Blott | 2016-04-08 07:55:13 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-04-08 07:55:16 +0100 | 
| commit | d1c230cabb051a5429242c98e67d37b65edc58b8 (patch) | |
| tree | cd7daec940a9a77041a1955ae7133d54148a7db8 /content_scripts/link_hints.coffee | |
| parent | bee5ee8416be776f379beb1bf772665a19cd3fa4 (diff) | |
| download | vimium-d1c230cabb051a5429242c98e67d37b65edc58b8.tar.bz2 | |
Do not post hint descriptors back to the frame itself.
When distributing hint descriptors, do not post a frame's own hint
descriptors back to the frame itself.  It already has them.
With regard to the message-passing cost only, this represents a speedup
of approximately 3/2 for link-busy sites like reddit -- several tens of
milliseconds for me.  There are other costs too (such as processing the
hint descriptors) bu these are not affected.
Diffstat (limited to 'content_scripts/link_hints.coffee')
| -rw-r--r-- | content_scripts/link_hints.coffee | 8 | 
1 files changed, 6 insertions, 2 deletions
| diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 56cea78d..70c51eac 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -82,13 +82,17 @@ HintCoordinator =      DomUtils.documentReady => Settings.onLoaded =>        requireHref = availableModes[modeIndex] in [COPY_LINK_URL, OPEN_INCOGNITO]        @localHints = LocalHints.getLocalHints requireHref -      @sendMessage "postHintDescriptors", hintDescriptors: -        @localHints.map ({linkText}, localIndex) -> {frameId, localIndex, linkText} +      @localHintDescriptors = @localHints.map ({linkText}, localIndex) -> {frameId, localIndex, linkText} +      @sendMessage "postHintDescriptors", hintDescriptors: @localHintDescriptors    # We activate LinkHintsMode() in every frame and provide every frame with exactly the same hint descriptors.    # We also propagate the key state between frames.  Therefore, the hint-selection process proceeds in lock    # step in every frame, and @linkHintsMode is in the same state in every frame.    activateMode: ({hintDescriptors, modeIndex, originatingFrameId}) -> +    # We do not receive the frame's own hint descritors back from the background page.  Instead, we merge them +    # with the hint descriptors from other frames here. +    [hintDescriptors[frameId], @localHintDescriptors] = [@localHintDescriptors, null] +    hintDescriptors = [].concat (hintDescriptors[fId] for fId in (fId for own fId of hintDescriptors).sort())...      # Ensure that the document is ready and that the settings are loaded.      DomUtils.documentReady => Settings.onLoaded =>        @suppressKeyboardEvents.exit() if @suppressKeyboardEvents?.modeIsActive | 
