CEF integration into Juce framework

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.

CEF integration into Juce framework

Postby steren » Wed Jan 15, 2014 11:55 am

Hi,I am currently prototyping an integration of CEF into the C++ Juce framework.
My goal is to create a CEF-based browser Juce component to be included into Juce applications.

Are you aware of any existing result with Juce and CEF?

I intend my main Juce application to be also a CefApp and have only one CefClient created at app startup that would create one browser per"view-component". Would this design make sense?

Regarding the display, would you recommend trying to create a Juce component class that is also a CefBrowser class?
Or should I better use an Offscreen Rendering technique and paint the result into Juce's paint() method?

Thanks a lot for your help.
steren
Newbie
 
Posts: 6
Joined: Wed Jan 15, 2014 9:46 am

Re: CEF integration into Juce framework

Postby steren » Mon Jan 20, 2014 10:24 am

Just a quick follow up on my progress.
I successfully merged the CEF simple project with a default Juce project (linking to wrapper .lib and to Dlls).

In my Juce application initialization function, I create an instance of SimpleApp, run CefExecuteProcess and then CefInitialize.
Since Juce is already taking care of running the message loop I couldn't use CefRunMessageLoop, and couldn't easily add CefDoMessageLoopWork to it. So I decided to go for the multi_threaded_message_loop = true setting as discussed here.

Unfortunately I am now facing an issue: when starting this application, a main Juce window is created as expected (because I did so in Juce's initialise() before creating the SimpleApp), then a CEF window is created, as expected from SimpleApp. But then two other ghost windows of the main Juce window are spawned. Clicking on any of them results in an application not responding.

The issue can be seen on this screenshot.

Would you have any direction? Can CEF interfere in the rendering process of juce even if executed in another thread?
steren
Newbie
 
Posts: 6
Joined: Wed Jan 15, 2014 9:46 am

Re: CEF integration into Juce framework

Postby steren » Mon Jan 20, 2014 12:01 pm

I just solved this issue by displaying the Juce window after the CefInitialize() function, instead of the contrary.
steren
Newbie
 
Posts: 6
Joined: Wed Jan 15, 2014 9:46 am

Re: CEF integration into Juce framework

Postby steren » Thu Jan 30, 2014 4:25 am

Just a quick follow up on my progress.

I worked on adding a custom scheme that triggers the opening of a Juce window from a CEF window.

I also worked on integrating CEF as a Juce component, and not only as an external window. For this I have been using off-screen rendering as described in the CEF documentation. The rendered buffer is copied to a Juce Image buffer and this image is drawned on my custom component in Juce Component::paint() method. I also have to send resize and mouse events to my CEF browser.
Performances with this custom component are really good, on this demo I can barely see a difference of framerate between a real CEF window and the custom component.
steren
Newbie
 
Posts: 6
Joined: Wed Jan 15, 2014 9:46 am

Re: CEF integration into Juce framework

Postby bobmanc » Tue Mar 03, 2015 11:02 am

I am interested in how this is going. I just started trying to get CEF running with JUCE.

I am trying to just open a chromium window by clicking on a JUCE button. If I call CefRunMessageLoop I can open the browser window but it blocks. I assume I need to call CefDoMessageLoopWork somewhere but I don't know where.
Any advice would be greatly appreciated.

Thanks.
bobmanc
Newbie
 
Posts: 9
Joined: Wed Feb 15, 2012 4:57 pm

Re: CEF integration into Juce framework

Postby magreenblatt » Tue Mar 03, 2015 1:15 pm

bobmanc wrote:I am interested in how this is going. I just started trying to get CEF running with JUCE.

I am trying to just open a chromium window by clicking on a JUCE button. If I call CefRunMessageLoop I can open the browser window but it blocks. I assume I need to call CefDoMessageLoopWork somewhere but I don't know where.
Any advice would be greatly appreciated.

Thanks.

On Windows you can use CefSettings.multi_threaded_message_loop instead of CefDoMessageLoopWork.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CEF integration into Juce framework

Postby bobmanc » Wed Mar 04, 2015 11:23 am

According to the docs...
///
// Set to true (1) to have the browser process message loop run in a separate
// thread. If false (0) than the CefDoMessageLoopWork() function must be
// called from your application message loop.
///
int multi_threaded_message_loop;

That said I have tried every permutation I can think of and it always crashes.
bobmanc
Newbie
 
Posts: 9
Joined: Wed Feb 15, 2012 4:57 pm

Re: CEF integration into Juce framework

Postby magreenblatt » Wed Mar 04, 2015 12:49 pm

bobmanc wrote:That said I have tried every permutation I can think of and it always crashes.

OK, what CEF version are you using and what is the symbolized stack trace for the crash? Debug symbols are available from http://cefbuilds.com.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: CEF integration into Juce framework

Postby bobmanc » Wed Mar 04, 2015 2:35 pm

Thanks for the help. Have you ever gotten it working with JUCE? My guess is it is just something simple with the way JUCE does things.
I am using cef_binary_3.1750.1738_windows32.
bobmanc
Newbie
 
Posts: 9
Joined: Wed Feb 15, 2012 4:57 pm

Re: CEF integration into Juce framework

Postby magreenblatt » Wed Mar 04, 2015 2:37 pm

bobmanc wrote:Thanks for the help. Have you ever gotten it working with JUCE? My guess is it is just something simple with the way JUCE does things.
I am using cef_binary_3.1750.1738_windows32.

That's an old CEF build and I've never done anything with JUCE. You might want to try a newer CEF branch (2171+). If the crash is in CEF then I can assist you in resolving it.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Next

Return to Support Forum

Who is online

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