• Alexey Kozyatinskiy's avatar
    [inspector] added Runtime.installBinding method · 49c4ac77
    Alexey Kozyatinskiy authored
    A lot of different clients use console.debug as a message channel from
    page to protocol client. console.debug is a little slow and not
    designed for this use case.
    
    This CL introduces new method: Runtime.installBinding. This method
    installs binding function by given name on global object on each
    inspected context including any context created later.
    Binding function takes exactly one string argument. Each time when
    binding function is called, Runtime.bindingCalled notification is
    triggered and includes passed payload.
    
    Binding function survives page reload and reinstalled right after
    console object is setup. So installed binding can be used inside
    script added by Page.addScriptToEvaluateOnNewDocument so client may do
    something like:
    Runtime.installBinding({name: 'send'});
    Page.addScriptToEvaluateOnNewDocument({source: 'console.debug = send'});
    .. navigate page ..
    
    In microbenchmark this function is ~4.6 times faster then
    console.debug.
    
    R=lushnikov@chromium.org,pfeldman@chromium.org
    
    Bug: none
    Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
    Change-Id: I3e0e231dde9d45116709d248f6e9e7ec7037e8e3
    Reviewed-on: https://chromium-review.googlesource.com/1077662
    Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
    Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#53462}
    49c4ac77
Name
Last commit
Last update
benchmarks Loading commit data...
build_overrides Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.editorconfig Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
ChangeLog Loading commit data...
DEPS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...
snapshot_toolchain.gni Loading commit data...