Correlating OnPaint() and OnProcessMessageReceived()

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Correlating OnPaint() and OnProcessMessageReceived()

Postby zerodefect » Tue Sep 29, 2020 4:58 pm

In an HTML example that I have generated, I have implemented requestAnimationFrame(). Each time the requestAnimationFrame() is called, it calls/executes a JS callback (which I have injected). This callback provides specific details about the current frame. This information is unique to each frame. For that reason, it is important that I correlate the message generated from OnProcessMessageReceived() with the corresponding OnPaint(). How do I do that?

I manually pump the renderer by using `CefDoMessageLoopWork()' at a regular rate, and I use it in conjunction with SendExternalEventFrame() - I have my own event loop.

Again, the difficulty I'm having is how to marry the OnPaint() with the corresponding OnProcessMessageReceived(). These are the biggest issues that I'm experiencing:
  • When the page is first loaded by CEF, I suspect that I may receive multiple OnPaint()'s before receiving first OnProcessMessageReceived()?
  • I observe situations where there is a cadence of 2 x OnPaint() followed by 2 x OnProcessMessageReceived() or sometimes situations where OnPaint() will be ahead of OnProcessMessageReceived().
  • Receive multiple OnProcessMessageReceived() without any OnPaint(). I appreciate that I won't receive an OnPaint() if there are no visual updates (an optimisation); however, I still need to correlate any generated OnPaint()'s with the corresponding OnProcessMessageReceived().

It's not any particular bullet point above that is the problem, but rather the combination of these issues. In summary (and fundamentally), I need to somehow correlate the OnPaint() with OnProcessMessageReceived().

Features we use:
  • OSR (windowless_rendering_enabled=1)
  • No Multithreaded Msg Loop (multi_threaded_message_loop=0).
  • Custom event loop (libevent2).
  • external_begin_frame_enabled=1/SendExternalBeginFrame().

Ubuntu 20.04 64-bit
CEF v85.3.11
zerodefect
Techie
 
Posts: 26
Joined: Tue Feb 20, 2018 11:24 am

Re: Correlating OnPaint() and OnProcessMessageReceived()

Postby zerodefect » Tue Sep 29, 2020 7:17 pm

Also, I'm not using GPU.
zerodefect
Techie
 
Posts: 26
Joined: Tue Feb 20, 2018 11:24 am

Re: Correlating OnPaint() and OnProcessMessageReceived()

Postby magreenblatt » Tue Sep 29, 2020 7:23 pm

See viewtopic.php?f=6&t=17519 for related discussion.
magreenblatt
Site Admin
 
Posts: 10547
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 33 guests