Commit 3d7e92af authored by Rayan Kanso's avatar Rayan Kanso Committed by Commit Bot

[Background Fetch] Fix ChromeOS delegate bug.

ChromeOS was creating multiple BackgroundFetchDelegate clients, and
overwriting the client initiating the fetches.

The fix was to check that we are not overwriting the client. This fixes
our problems in the short term, and a longer term fix is planned in
crbug.com/907075.

The fix works on ChromeOS head, as well as 71 (tested via manually
merging the change).

Bug: 907038
Change-Id: Ic1d5bc9f55b22359aa592c71f49d8ab5ed90de5e
Reviewed-on: https://chromium-review.googlesource.com/c/1344030
Commit-Queue: Rayan Kanso <rayankans@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609975}
parent 1ffe990d
......@@ -92,6 +92,13 @@ class BackgroundFetchDelegateProxy::Core
std::unique_ptr<BackgroundFetchDescription> fetch_description) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// If there are multiple clients created we might have registered the wrong
// one with the delegate by overwriting it. This check makes sure that we
// register the correct client until multiple clients are supported.
// TODO(crbug.com/907075): Support multiple clients.
if (delegate_ && delegate_->client().get() != this)
delegate_->SetDelegateClient(GetWeakPtrOnUI());
if (delegate_)
delegate_->CreateDownloadJob(std::move(fetch_description));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment