commit | 38f920aa1b6e8ffcc4cb7756313f2c118422c0f8 | [log] [tgz] |
---|---|---|
author | tzik <tzik@chromium.org> | Wed Aug 01 04:41:20 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Wed Aug 01 04:41:20 2018 |
tree | 8f43cae1a6e116eba7d700a29fee126d7bf01a57 | |
parent | e8b35f103834f43a85fd5a14af1f3cef977c498d [diff] |
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}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .