Page 1 of 1

Wait after load for background task

PostPosted: Tue Feb 13, 2018 8:24 am
by pmadr
Hi,

I'm trying to use offscreen rendering. It works fine but I have troubles with this page:
https://www.edumen.cz/auto_translate.html

In my browser handler I wait for all IO to finish in OnLoadEnd. It works on many pages but auto_translate.html doesn't show page translated.
I see that translation XHR request is done after a browser is closing (browser->GetHost()->CloseBrowser(true);), like it was blocked by something.

Translation XHR request is:
https://translate.googleapis.com/transl ... =en&tl=cs&

Can I somehow unblock this request and let it run before rendering?

Re: Wait after load for background task

PostPosted: Tue Feb 13, 2018 8:58 am
by magreenblatt
How are you running the message loop? How are you waiting for IO to finish?

Re: Wait after load for background task

PostPosted: Tue Feb 13, 2018 9:22 am
by pmadr
I run message loop by CefRunMessageLoop();

IO checker checks periodically if all requests (collected in OnBeforeResourceLoad) are finished by CefPostDelayedTask on TID_UI.

I tried to disable my IO checker completely and just wait a specific time by
CefPostDelayedTask(TID_UI, call_renderer, delay);
in OnLoadEnd and afterwards call renderer. XHR request was not processed regardless delay time. Its OnBeforeResourceLoad event is called always after browser->GetHost()->CloseBrowser(true);

Re: Wait after load for background task

PostPosted: Tue Feb 13, 2018 10:48 am
by magreenblatt
Does the problem reproduce in the cefclient sample application? Are you setting browser visibility state correctly in your application (calling WasHidden)?

Re: Wait after load for background task

PostPosted: Wed Feb 14, 2018 2:51 am
by pmadr
Thank you very much. Calling WasHidden(false) works perfectly.