• tzik's avatar
    Start BindStateBase ref count from 1 instead of 0 · 65f39693
    tzik authored
    The first atomic increments of ref counts are generally unneeded if the
    ref count starts from 1 instead of 0, and we can detect an invalid AddRef
    from 0 to 1 in that case.
    Especially, the ref count in BindStateBase is incremented 300k times in
    its constructor by the first page load from the browser boot, and also
    it sometimes hits invalid state.
    Note that 300k atomic increments are probably not so time consuming as
    we can measure.
    This CL adds `base::AdoptRef` to scoped_refptr for ref counted types whose
    ref count start from 1, and converts BindStateBase to use it.
    Review-Url: https://codereview.chromium.org/2723423002
    Cr-Commit-Position: refs/heads/master@{#461372}
callback_internal.cc 3.13 KB