- Code: Select all
void CloseAllBrowsers(bool force_close)
{
if (!CefCurrentlyOn(TID_UI)) {
// Execute on the UI thread.
base::OnceClosure callback = base::BindOnce(&CloseAllBrowsers, force_close);
CefPostTask(TID_UI, callback);
return;
}
for (unsigned int t = 0; t < WebRenderServiceIPC::BUFFER_HEADER::NUM_TABS; t++)
g_acpBrowsers[t]->GetHost()->CloseBrowser(force_close);
CefQuitMessageLoop();
}
I've compared to examples and tons of web code, and I don't see the issue with my usage of BindOnce, however I am getting a compile-time error:
Error C2664 'bool CefPostTask(CefThreadId,scoped_refptr<CefTask>)': cannot convert argument 2 from 'base::OnceClosure' to 'scoped_refptr<CefTask>'
Peeking header files, it is true that CefPostTask requires a CefTask. What am I missing to get my OnceClosure to function as a scoped_refptr<CefTask>?
Tried a few versions, but currently using cef_sdk 116.0.19 from nuget, in c++ obviously.