Start BindStateBase ref count from 1 instead of 0

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}


CrOS-Libchrome-Original-Commit: 65f39693c549f42146b26cd35b13fa6a94fa0744
7 files changed
tree: 5be75bd12af28858db62e41a348226873d84ff6a
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/