Make ContentDirectoryLoaderFactory always owned by its |receivers_|.
This CL introduces ContentDirectoryLoaderFactory::CreateAndBind static method that allows creating an ContentDirectoryLoaderFactory that is owned by its |receivers_| and will self-delete when the last receiver disconnects. This CL removes the ability to directly construct and own a std::unique_ptr<ContentDirectoryLoaderFactory>, because this ability means that the factory can be destructed while receivers bound via the Clone method are still alive (see the associated bug). In particular, this CL stops exposing ContentDirectoryLoaderFactory constructor as a public member, which forces construction to go via the new CreateAndBind static method. This CL mostly just follows the pattern established earlier by https://crrev.com/c/2337411. Bug: 1106995 Change-Id: I5ed88648637eed43f23dfab234115bfa33281ccc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2357964 Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Reviewed-by:Kevin Marshall <kmarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#812152}
Showing
Please register or sign in to comment