Getting the CefBrowser in OnRenderProcessThreadCreated

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

Getting the CefBrowser in OnRenderProcessThreadCreated

Postby dshaulov » Sun Sep 22, 2013 3:23 am

Hi,

In OnRenderProcessThreadCreated I need to send some extra_info that is specific to the browser object.
Is it possible to add a CefBrowser parameter to that method?
Specifically - I need to know if I should or should not add JS integration method in "OnContextCreated".
And I don't see how I can do that with async process messages.

Thanks, Daniel.
dshaulov
Techie
 
Posts: 37
Joined: Sun Dec 09, 2012 10:58 am

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby dshaulov » Sun Sep 22, 2013 3:56 am

Looking at the code - It seems even better to expose a "OnBeforeCreated" method in CefLifeSpanHandler that has an "extra_info" param - that will be passed to "OnBrowserCreated" on the renderer side.
This way - we also cover the case where a new browser is created in an old renderer process (for instance, because of the process limit).

This seems easy enough since we already have the CefProcessHostMsg_GetNewBrowserInfo message, which is sync and called before "OnBrowserCreated".
dshaulov
Techie
 
Posts: 37
Joined: Sun Dec 09, 2012 10:58 am

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby magreenblatt » Sun Sep 22, 2013 6:43 am

There may be multiple browser objects per render process. Also, in the case of popup windows the render process representation will be created before the browser process object so it doesn't know the new browser ID. In conclusion, the answer to your question is no. You need to use the IPC mechanism to transfer any browser-specific state after OnBrowserCreated is called in the render process.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby dshaulov » Tue Sep 24, 2013 6:00 pm

Ok, how about moving it more backwards - sending the extra_info in "CreateBrowser" / "CreateBrowserSync", and getting it in the OnBrowserCreated on renderer side, does this make more sense?
dshaulov
Techie
 
Posts: 37
Joined: Sun Dec 09, 2012 10:58 am

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby magreenblatt » Wed Sep 25, 2013 2:29 am

dshaulov wrote:Ok, how about moving it more backwards - sending the extra_info in "CreateBrowser" / "CreateBrowserSync", and getting it in the OnBrowserCreated on renderer side, does this make more sense?

What about popup windows where CreateBrowser isn't called?
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby dshaulov » Wed Sep 25, 2013 4:23 am

Make it also a parameter for OnBeforePopup? (Same as for the rest of the parameters to CreateBrowser - CefClient, CefWindowInfo and CefBrowserSettings)
dshaulov
Techie
 
Posts: 37
Joined: Sun Dec 09, 2012 10:58 am

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby magreenblatt » Wed Sep 25, 2013 4:44 am

dshaulov wrote:Make it also a parameter for OnBeforePopup? (Same as for the rest of the parameters to CreateBrowser - CefClient, CefWindowInfo and CefBrowserSettings)

That should be possible. Feel free to create an issue in the issue tracker.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

Postby dshaulov » Wed Sep 25, 2013 3:26 pm

dshaulov
Techie
 
Posts: 37
Joined: Sun Dec 09, 2012 10:58 am


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 15 guests