Handle case where IO thread is not yet running, in C67 this results

in a hard crash

refs: https://chromium-review.googlesource.com/c/chromium/src/+/973556
This commit is contained in:
Samuel Attard 2018-07-22 03:42:18 +10:00 committed by Aleksei Kuzmin
parent 0b2b44becf
commit cad1d9aa9c

View file

@ -39,7 +39,8 @@ void SetApplicationLocaleOnIOThread(const std::string& locale) {
void BrowserClient::SetApplicationLocale(const std::string& locale) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!BrowserThread::PostTask(
if (!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
!BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::BindOnce(&SetApplicationLocaleOnIOThread, locale))) {
g_io_thread_application_locale.Get() = locale;