I tried to call RootWindowManager::GetWindowForBrowser from a function called using CefPostTask(TID_UI, base::Bind( myfunction, ... )) with this code:
- Code: Select all
scoped_refptr<client::RootWindow> rootwin = client::MainContext::Get()->GetRootWindowManager()->GetWindowForBrowser(browser_id);
It tripped the check for REQUIRE_MAIN_THREAD(); == DCHECK(CURRENTLY_ON_MAIN_THREAD()) == client::MainMessageLoop::Get()->RunsTasksOnCurrentThread() == return (thread_id_ == base::PlatformThread::CurrentId());
So apparently TID_UI is not the thread for the main message loop when settings.multi_threaded_message_loop = true;
Is this correct? I can hack around it by using a Windows PostMessage with a control ID, then have the message event call myfunction, but it would be cleaner to be able to do CefPostTask(TID_MAIN, ... if there was such a thing as TID_MAIN. Or if TID_UI really was the UI thread when multi_threaded_message_loop = true which it apparently is not?
If needed I can put together a version of this using CefClient.