Passing messages between the Render and Browser processes

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.

Passing messages between the Render and Browser processes

Postby palaver » Wed Nov 25, 2015 10:28 am

I am trying to learn about how to pass information between processes using CEF3, and I am a little confused:

With every sample application I look at, it seems that only one type of process (either browser or render) is launched. For example, in the cefclient_win example, we have:
Code: Select all
ClientApp::ProcessType process_type = ClientApp::GetProcessType(command_line);
if (process_type == ClientApp::BrowserProcess)
    app = new ClientAppBrowser();
else if (process_type == ClientApp::RendererProcess)
    app = new ClientAppRenderer();
else if (process_type == ClientApp::OtherProcess)
    app = new ClientAppOther();

Let's say that the first branch of the above conditional is successful and the browser process is initialized. Where then does the communication with the render process happen? Where is the render process launched?
palaver
Techie
 
Posts: 36
Joined: Wed Nov 25, 2015 9:51 am

Re: Passing messages between the Render and Browser processe

Postby magreenblatt » Wed Nov 25, 2015 12:54 pm

Additional processes are created as needed. When the process is created an IPC channel is established. See https://www.chromium.org/developers/des ... chitecture for details.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Passing messages between the Render and Browser processe

Postby palaver » Wed Nov 25, 2015 2:47 pm

Thanks for that. What confused me a little bit was the cefsimple application, which ran without any client implementation of the Render Process handler. In the cefclient example, we check the command line flags, and based on those, we launch either a render or browser process handler, which makes sense to me. But in cefsimple, all we do is create a SimpleApp, which is a CefBrowserProcessHandler, and I wasn't sure where the render process handler came into play there. Am I missing something?
palaver
Techie
 
Posts: 36
Joined: Wed Nov 25, 2015 9:51 am

Re: Passing messages between the Render and Browser processe

Postby magreenblatt » Wed Nov 25, 2015 2:56 pm

palaver wrote:But in cefsimple, all we do is create a SimpleApp, which is a CefBrowserProcessHandler, and I wasn't sure where the render process handler came into play there. Am I missing something?

I see why you're confused. Since SimpleApp does not implement CefRenderProcessHandler it would be clearer if the example program passed NULL to CefExecuteProcess instead of the SimpleApp instance.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Passing messages between the Render and Browser processe

Postby magreenblatt » Wed Nov 25, 2015 3:02 pm

magreenblatt wrote:
palaver wrote:But in cefsimple, all we do is create a SimpleApp, which is a CefBrowserProcessHandler, and I wasn't sure where the render process handler came into play there. Am I missing something?

I see why you're confused. Since SimpleApp does not implement CefRenderProcessHandler it would be clearer if the example program passed NULL to CefExecuteProcess instead of the SimpleApp instance.

I've filed https://bitbucket.org/chromiumembedded/cef/issues/1776 for this.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Passing messages between the Render and Browser processe

Postby palaver » Wed Nov 25, 2015 3:11 pm

That's perfect, kudos on filing an issue.
palaver
Techie
 
Posts: 36
Joined: Wed Nov 25, 2015 9:51 am


Return to Support Forum

Who is online

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