CEF3: How to get V8 context and global object?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

CEF3: How to get V8 context and global object?

Postby tuma » Thu Sep 06, 2012 1:02 am

Hi,

I need to get get global object to invoke some JS function. The code that was working in CEF1 doesn't work now. It gives me "GetV8Context cannot be called from the browser process" error.

I am trying to invoke this from OnLoadEnd call back.
GetMainFrame()->GetV8Context()->GetGlobal();

What is the right way to do it?
- tumapathy
tuma
Techie
 
Posts: 37
Joined: Fri May 11, 2012 3:26 am

Re: CEF3: How to get V8 context and global object?

Postby tuma » Thu Sep 06, 2012 9:51 am

I played around in cefclient code. It seems like these are accessible only from renderer process only. If I debug RENDER process and put break point in OnContextCreate, it hits there and I am able to call GetGlobal().

I have some code in BROWSER process which need to access and manipulate the V8 context and dom objects.

So do we need to do kind of inter-process communication from browser process to render process to perform any task in V8? Is there any mechanism that CEF3 provides for this purpose?
- tumapathy
tuma
Techie
 
Posts: 37
Joined: Fri May 11, 2012 3:26 am

Re: CEF3: How to get V8 context and global object?

Postby magreenblatt » Thu Sep 06, 2012 9:59 am

Yes, use SendProcessMessage with an asynchronous JS API. See http://www.chromium.org/developers/desi ... design-doc for example API design.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF3: How to get V8 context and global object?

Postby tuma » Fri Sep 21, 2012 5:37 am

Is there any way to make synchronous call from render process to browser process? I am implementing a CefV8Handler in render process to expose some custom function to Java script. In this I have to make some query to browser process and get response synchronously. How to do this?
- tumapathy
tuma
Techie
 
Posts: 37
Joined: Fri May 11, 2012 3:26 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 148 guests