- Code: Select all
void MyClass::GetDataHelper() {
<in the Browser/UI thread>
CefRefPtr<WebRequestDelegate> delegate = new WebRequestDelegate();
CefPostTask(TID_IO, NewCefRunnableMethod(this, &MyClass::StartUrlRead, url, delegate);
<block on a condition variable and wait for the request to finish>
}
The StartUrlRead method looks as follows:
- Code: Select all
void MyClass::StartUrlRead(const char* url, CefRefPtr<WebRequestDelegate> delegate) {
CefRefPtr<CefRequest> request = CefRequest::Create();
request->SetMethod("GET");
request->SetURL(url);
CreateUrlRequest(request, delegate);
}
After the CefPostTask call our UI thread blocks via a condition variable that is signaled by the request delegate when the request finishes. This has worked perfectly up through the 2171 branch. This week we attempted to update to the 2454 branch on Mac and it no loner works. With 2454, the request delegates methods like OnDownloadData() are not called while the UI thread is blocked. As soon as the UI thread becomes unblocked, the request delegate methods start getting called. It's as if the IO thread is not able to run while the UI thread is blocked. Has the implementation of the threading or the url request changed in any way that would cause this?
I am about to try this on Win to see if it exhibits the same behavior and will report back.
John