Avoid Bind()ing AsyncDelegateLogger when it has no owner

AsyncDelegateLogger is a ref counted class, and its instance is
destroyed when all of its reference is released. So, an unexpected
first reference creation may cause an unexpected early destruction.

AsyncDelegateLogger::Start() used to run before the first reference is
made, and the first reference used to be made by base::Bind in Start()
implicitly. The reference is released when the callback instance is
destroyed, so the instance may be destroyed in Start().

Though this case is safe, as no one touch the instance after Start(),
an upcoming change to base::Bind() disables this pattern of implicit
first reference creation as it's error prone.

After this CL, AsyncDelegateLogger::Run() holds the reference to
avoid implicit first reference creation, and to avoid the check
failure.

Bug: 866456
Change-Id: I719dd6f398f2d3ce4f5d3243a326b4f2d792381e
Reviewed-on: https://chromium-review.googlesource.com/1156705
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579701}
1 file changed