CEFUserData usage

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

CEFUserData usage

Postby Meghavi » Wed Sep 25, 2013 7:49 am

Hi,

I am not able to gather much information about CEFUserData and in which scenarios to use it.
Can someone provide a simple usecase for which CEFUserData could be used.

Thanks
Meghavi
Techie
 
Posts: 29
Joined: Fri Sep 20, 2013 4:48 am

Re: CEFUserData usage

Postby magreenblatt » Wed Sep 25, 2013 9:33 am

UserData allows you to associate an object derived from CefBase with a V8 object. It's life span will be correllated with the V8 object's life span (the V8 object keeps a reference to the UserData object that gets released when the V8 object is GC'ed). The UserData object can be retrieved from the V8 object in native code via GetUserData.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: CEFUserData usage

Postby Czarek » Wed Sep 25, 2013 12:27 pm

That looks like a cool feature. I haven't noticed it earlier in header files. How should I make the cast
when calling GetUserData(), for it to be safe?
Maintainer of the CEF Python, PHP Desktop and CEF C API projects. My LinkedIn.
User avatar
Czarek
Virtuoso
 
Posts: 1927
Joined: Sun Nov 06, 2011 2:12 am

Re: CEFUserData usage

Postby magreenblatt » Wed Sep 25, 2013 12:51 pm

Czarek wrote:That looks like a cool feature. I haven't noticed it earlier in header files. How should I make the cast
when calling GetUserData(), for it to be safe?

Only your application will assign UserData objects, so you can provide your own base class extending CefBase that provides isX() and toX() methods.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: CEFUserData usage

Postby Meghavi » Thu Sep 26, 2013 9:05 am

Thanks.
Can this CefUserData be accessed in Javascript?
Meghavi
Techie
 
Posts: 29
Joined: Fri Sep 20, 2013 4:48 am

Re: CEFUserData usage

Postby magreenblatt » Thu Sep 26, 2013 12:27 pm

Meghavi wrote:Thanks.
Can this CefUserData be accessed in Javascript?

No, UserData is only available from native code. You can of course define your own JS bindings that access the UserData.
magreenblatt
Site Admin
 
Posts: 12407
Joined: Fri May 29, 2009 6:57 pm

Re: CEFUserData usage

Postby Meghavi » Fri Sep 27, 2013 3:32 am

Thanks this feature has proved very useful to us
Meghavi
Techie
 
Posts: 29
Joined: Fri Sep 20, 2013 4:48 am

Re: CEFUserData usage

Postby szanto90balazs » Tue Nov 25, 2014 4:02 am

Hello,

Just like Meghavi, I'm interested in how can I benefit from using CefUserData?

Meghavi, could you please elaborate on how you used the CefUserData?

Thanks
Balazs
szanto90balazs
Newbie
 
Posts: 4
Joined: Tue Jul 08, 2014 11:44 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 20 guests