Stop binding ownerless ref-count objects in //content
An upcoming change to base::Bind rejects binding ref counted objects when their ref count is zero, as that pattern of usage is error prone. This CL updates that pattern in //content. For DOMStorageContextWrapper, the instance and a MemoryPressureListener used to own each other implicitly. And, after this CL, DOMStorageContextWrapper owns MemoryPressureListener. For PlatformNotificationContextImpl, its Initialize() makes a reference to the instance, and drops it soon. So, without keeping a reference in caller, Initialize() may destroy the instance. For WebContentsImpl::RequestAXTreeSnapshot, this should also keep a reference to the instance, as AXTreeSnapshotCombiner::AddFrame called by RecursiveRequestAXTreeSnapshotOnFrame makes a reference to AXTreeSnapshotCombiner, and releases the reference after the method call. So, that destroys AXTreeSnapshotCombiner instance implicitly. SW's StoppedObserever and TestFileErrorInjector is the false positive cases of the check. Bug: 866456 Change-Id: Ie99c996fdcf2413b170de2a246d63c34433a24ac Reviewed-on: https://chromium-review.googlesource.com/1156200Reviewed-by:Kinuko Yasuda <kinuko@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#579754}
Showing
Please register or sign in to comment