Keep reference to DOMStorageNamespace while it's being cloned
While DOMStorageNamespace::Clone constructs an instance, it binds it to a callback, post it to a task runner and returns the instance as a raw pointer. Note that base::BindOnce here retains a reference to |clone| and releases the reference when the callback instance is destroyed. However, if PostTaskAndReply there failed, the callback instance is destroyed immediately and DOMStorageNamespace loses the last reference. Then, DOMStorageNamespace::Clone may return a stale pointer. This CL converts the return value to scoped_refptr, and has Clone() to keep the reference to the resulting instance. Bug: 866456 Change-Id: Ic3a5a02e266bf55f8ad3c4f901eb1eebc2ea9d8e Reviewed-on: https://chromium-review.googlesource.com/1146409Reviewed-by:Daniel Murphy <dmurph@chromium.org> Commit-Queue: Taiju Tsuiki <tzik@chromium.org> Cr-Commit-Position: refs/heads/master@{#577377}
Showing
Please register or sign in to comment