Commit 7206ce51 authored by David Bienvenu's avatar David Bienvenu Committed by Commit Bot

Fix DCHECK in browser_tests with VirtualDesktopHelper.

Pass this (base::RefCountedDeleteOnSequence) instead of a weakptr
to PostTaskAndReplyWithResult.

This should fix a lot of test flakiness due to a dcheck doing a
PostTaskAndReplyRelay.

Bug: 1093448
Change-Id: I7cb4621009c350a60c3769c6fb691a144c6fd5e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2346994Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: David Bienvenu <davidbienvenu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#796637}
parent 5d977935
......@@ -65,8 +65,6 @@ class VirtualDesktopHelper
void SetInitialWorkspaceRemembered(bool remembered);
base::WeakPtr<VirtualDesktopHelper> AsWeakPtr();
private:
friend class base::RefCountedDeleteOnSequence<VirtualDesktopHelper>;
friend class base::DeleteHelper<VirtualDesktopHelper>;
......@@ -136,7 +134,7 @@ void VirtualDesktopHelper::UpdateWindowDesktopId(
FROM_HERE,
base::BindOnce(&VirtualDesktopHelper::GetWindowDesktopIdImpl, hwnd,
virtual_desktop_manager_),
base::BindOnce(&VirtualDesktopHelper::SetWorkspace, AsWeakPtr(),
base::BindOnce(&VirtualDesktopHelper::SetWorkspace, this,
base::Passed(std::move(callback))));
}
......@@ -148,10 +146,6 @@ void VirtualDesktopHelper::SetInitialWorkspaceRemembered(bool remembered) {
initial_workspace_remembered_ = remembered;
}
base::WeakPtr<VirtualDesktopHelper> VirtualDesktopHelper::AsWeakPtr() {
return weak_factory_.GetWeakPtr();
}
void VirtualDesktopHelper::SetWorkspace(WorkspaceChangedCallback callback,
const std::string& workspace) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
......
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