diff options
| author | Stephen Blott | 2015-01-04 14:54:04 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-01-04 14:54:04 +0000 | 
| commit | 7e4fdac07ffb59c438a17c2c88051064aaab16b5 (patch) | |
| tree | 36f1e187818bee9448796e2f8a4df4ee9cc312c4 /lib/clipboard.coffee | |
| parent | a5adf7c06128cc963a09acc9960bab1117b55d1a (diff) | |
| download | vimium-7e4fdac07ffb59c438a17c2c88051064aaab16b5.tar.bz2 | |
Revise handler stack implementation.
The old implementation:
- Wasn't actually checking whether handlers had been removed before
  calling them.
- Could end up calling the same handler twice (if a handler was removed
  further down the stack, and the stack elements moved due the resulting
  splice.
Solution:
- Mark elements as removed and check.  Set their ids to null.
- Don't splice stack.
Also, optimisation:
- Removing the element at the top of the stack is still O(1).
- In Modes, reverse handlers before removing (so, more likely to hit the
  optimisation above).
For the record, the stable stack length at the moment seems to be about
10-12 elements.
Diffstat (limited to 'lib/clipboard.coffee')
0 files changed, 0 insertions, 0 deletions
