Commit 584e16ef authored by fdoray's avatar fdoray Committed by Commit bot

Flush TaskScheduler in ProfileBrowserTest.*.

When the BrowserScheduler/RedirectHistoryService experiment is disabled,
HistoryService uses a dedicated thread for backend operations. This thread
is joined when the HistoryService is deleted.

When the BrowserScheduler/RedirectHistoryService experiment is enabled,
HistoryService uses a TaskScheduler sequence for backend operations.
These tasks can run after the HistoryService has been deleted.

History backend tasks access databases in the profile directory. A crash
occurs if these accesses occur after the profile directory has been deleted.
To prevent this from happening in ProfileBrowserTest.*., this CL adds code to
flush TaskScheduler before deleting the profile directory.

BUG=661143, 676714

Review-Url: https://codereview.chromium.org/2611053003
Cr-Commit-Position: refs/heads/master@{#441951}
parent ed8dccd0
......@@ -18,6 +18,7 @@
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/task_scheduler/task_scheduler.h"
#include "base/values.h"
#include "base/version.h"
#include "build/build_config.h"
......@@ -152,6 +153,10 @@ void SpinThreads() {
content::RunAllPendingInMessageLoop();
content::RunAllPendingInMessageLoop(content::BrowserThread::DB);
content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
// This prevents HistoryBackend from accessing its databases after the
// directory that contains them has been deleted.
base::TaskScheduler::GetInstance()->FlushForTesting();
}
// Sends an HttpResponse for requests for "/" that result in sending an HPKP
......
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