Commit 7221e1a3 authored by Mohsen Izadi's avatar Mohsen Izadi Committed by Commit Bot

Fix flakiness in HeadlessBrowserTest

In HeadlessContentMainDelegate::RunProcess(), if the headless browser
instance is destroyed before browser runner is shut down, GPU clients
might end up accessing the destroyed object in the meantime. An example
is when a client tries to establish a GPU channel ending up accessing
destroyed HeadlessBrowserImpl::options in order to instantiate
viz::GpuHostImpl. This CL changes the ordering to fix the race
condition.

BUG=881211
TEST=headless_browsertests --gtest_filter=HeadlessBrowserTest.*

Change-Id: I2518eeefcc1e446a59d680fa78eab88e26765404
Reviewed-on: https://chromium-review.googlesource.com/1251331Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Commit-Queue: Mohsen Izadi <mohsen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595465}
parent 9a13eecb
...@@ -282,8 +282,8 @@ int HeadlessContentMainDelegate::RunProcess( ...@@ -282,8 +282,8 @@ int HeadlessContentMainDelegate::RunProcess(
browser_->RunOnStartCallback(); browser_->RunOnStartCallback();
browser_runner->Run(); browser_runner->Run();
browser_.reset();
browser_runner->Shutdown(); browser_runner->Shutdown();
browser_.reset();
// Return value >=0 here to disable calling content::BrowserMain. // Return value >=0 here to disable calling content::BrowserMain.
return 0; return 0;
......
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