I'm working to integrate chromium embedded framework into a cinder project on which I've been working. I keep running into issues even integrating with a basic cinder project and am hoping that someone has already done work on the integration. I'd love any insight or (of course) a block. If not I'll keep working and post my work when finished.
We've been messing with CEF internally, its a beast. Really powerful and hard to tame, but also very promising in terms of flexibility and performance. If you're having specific problems integrating, ask away and I'll help if I can.
I'm curious to know how you solved the clean up issue/crash a lot of people seems to have. How and when do you clean up CEF before closing the application? Are you using CefShutdown();? CloseBrowser(true);? Can't figure out what to do without making the application crash at the end.
Thanks a lot!
Otherwise it does seem quite powerful and nicely written but hard to find good resources to get started.
@Brett: If you're still having issue I would recommend reading the tutorial page on their wiki. Looking at and copying the build settings of the clientsimple example from the sdk helped me a lot as well. There's also this very short example showing an Ogre implementation: http://markus-lanner.com/cef/ogre_demo/main.cpp
There are two fronts on which I am having trouble. The first is getting all the necessary project settings correct for both cinder and cef to work. The second is integrating a barebones implementation of cef into a simple cinder app's code. The samples I've seen are so complex I've had trouble grasping the structure and purpose of the pieces of the project.
For the second, I think this post would be useful... if I could get the first working properly:
@simon I'm trying my damndest to solve the crash at shutdown, but no success yet. You can see an ongoing conversation with the CEF author here. Its also worth mentioning that on windows, it looks like something gets leaked at shutdown but it is harmless, it seems you can safely just ignore CefShutdown and let the system clean up. On mac however, there is a nagging EXC_BAD_ACCESS from a stale pointer in the autorelease pool..
While I can't directly share any work I've done with CEF+cinder at the moment, I can say that my starting point was not the mammoth CefClient sample (which is really more of a testing bed), but the newer CefSimple, which is a slimmed version requested by many on the CEF forum. It seems to only be in trunk still, you can find it here.
@Brett yea setting up the project is difficult. I had to start with the CefSimple project, modify the post build scripts (for packaging the framework), and then add in the cinder settings.
That's weird, I couldn't see your answer before login-in! Thanks for the details Rich!
I stumbled upon your threads on CEF forums a few time and it seems that we've been taking the same road trying to track down this issue. I still have no cue about what's happening with this damned autorelease pool at the moment.
Do you have any news regarding this issue you could share here?
If not maybe it would be good to put together a cinder's friendly CefSimple sample on github, and try to work from there. What do you think? I can probably work on this in the next few days.
I went back and forth with the author a few times on trying fix this, and eventually I just ran out of things to try.
The biggest thing is that the cefclient testbed included with CEF relies on chromium to poll events (CefRunMessageLoop() / CefQuitMessageLoop()), whereas frameworks like cinder need to poll the event loop a different way (CefDoMessageLoopWork()). The shutdown hairyness is coming from this. We're still using it in our current project, but this along with a few other quirks make me hesitent to package it as a cinderblock. That, along with being tied up in 2-3 other pieces of code I want to get into the next cinder release... nagging at me every day I come home from the office. :)
I would say the thing to do is present the problem as a test in some way that the CEF author can investigate, and file an issue here with it. I don't expect him to get a cinder app running, probably the best bet is a mac app with xcodeproject that runs its own NSTimer + CefDoMessageLoopWork(). Due to the structure of the framework though, its alot of work and I can't commit the time at the moment. Still, if we could get that issue sorted, it'd be much easier to justify investing the time to wrap it as a general-purpose web embedding block.
Yeah that makes sense. I'll try to see if I can put this xcodeproject together.
I'm using chromium in a project right now as well and apart from this issue it is really a great piece of code. Regarding the kind of UI I need for this project CEF is definitely the way to go, and I can definitely see myself using it in a lot of upcoming projects. As it seems that there's not too much people not using their CefRunMessageLoop and running their own loops, it definitely worth helping them sorting out this issue (if the issue is on their side). I'll let you know!
Not to zombie this thread, but I'm about to dive into the wilds of CEF myself, wondering if anyone has any advice/tips/best practices/caveats in general (not necessarily Cinder specific) I should be aware of. Thanks!
Hah! I'm alllmost at that point, but thankfully I have simple offscreen rendering working now, if I can figure out a few more things, I should be good. I can post up the project if anyone's interested.