Re: Share NSView between processes
Re: Share NSView between processes
- Subject: Re: Share NSView between processes
- From: Zak Nelson <email@hidden>
- Date: Sat, 22 Sep 2012 16:52:14 -0700
- Acceptlanguage: en, en-US
- Thread-topic: Share NSView between processes
Thanks Jens. CEF (Chromium Embedded Framework) has some advantages over WebView. It's cross platform, provides more extensive hooks into the web view, allows for remote debugging, and automatically sandboxes the HTML code in its own process. In my case, the HTML will come from third-parties so it's especially useful to isolate them.
I should mention too, I already have CEF1 working with this multi-process approach to a first approximation and it is a bit gnarly. The main process forwards input events over IPC and both processes share an IOSurface. On the child process' side, I can use CEF1's "off-screen rendering" support, which lets me make calls like myBrowser->SendMouseClickEvent, myBrowser->SendMouseMouseEvent, etc. CEF3 on the other hand does not yet have support for these functions and I was wondering if I could work around them by sending the cocoa events directly.
Zak
From: Jens Alfke <email@hidden<mailto:email@hidden>>
Date: Sunday, September 23, 2012 5:18 AM
To: Zak Nelson <email@hidden<mailto:email@hidden>>
Cc: Ken Thomases <email@hidden<mailto:email@hidden>>, Cocoa Dev <email@hidden<mailto:email@hidden>>
Subject: Re: Share NSView between processes
This is possible to do, but it’s a _buttload_ of work. Chrome does it (and now Safari). It involves setting up shared memory buffers for pixmaps and using a lot of IPC calls to route events back and forth. Which sounds straightforward at this level, but this level is sort of like “you play the flute by blowing in one end and wiggling your fingers over the holes”, to quote Monty Python. I worked on Chrome for a year, and saw bits of the code to make this happen, and it looked Extremely Gnarly. Especially when you get into stuff like browser plugins, and hardware-accelerated graphics that want to render directly to the screen not to a pixmap.
If the framework generates HTML, why can’t you capture its HTML and send that to your app to display in a WebView? Or run a trivial little HTTP server in the framework process and point a WebView at that URL in the app; I’ve written several programs that use this approach.)
OK, wait, I just noticed that the framework you want to embed _is_ Chromium. The obvious question is, why can’t you just use a WebView instead? Is there some kind of functionality you need that only exists in Chromium’s fork of WebKit and not Apple’s?
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden