how to bind a C++ object to the same v8 Object

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.

Re: how to bind a C++ object to the same v8 Object

Postby colinChan008 » Thu Sep 16, 2021 9:40 am

magreenblatt wrote:
colinChan008 wrote:cache the object in the Js layer doest not help anything, as our cache will retain the object all the time. as a result, the C++ object will not release.

If the JS code releases the reference then the object should be GC'd and the C++ object will be released. That is up to your JS code (e.g. by assigning null to the variable that stores the natively bound object).

if we cache in js, it need me to release manually, but our coder usually won't do this and we can't require they to do this in js too. because it is unhuman.So this suggestion is hard to be performed.
colinChan008
Techie
 
Posts: 12
Joined: Thu Sep 16, 2021 3:27 am

Re: how to bind a C++ object to the same v8 Object

Postby magreenblatt » Thu Sep 16, 2021 10:58 am

I agree, but that pretty much covers your options. If you don’t keep a CefV8Value reference then SetWeak should be called automatically when the last reference is removed.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: how to bind a C++ object to the same v8 Object

Postby magreenblatt » Thu Sep 16, 2021 11:04 am

magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: how to bind a C++ object to the same v8 Object

Postby colinChan008 » Thu Sep 16, 2021 8:12 pm

is there a roadmap to support bind to same js object?
colinChan008
Techie
 
Posts: 12
Joined: Thu Sep 16, 2021 3:27 am

Re: how to bind a C++ object to the same v8 Object

Postby magreenblatt » Fri Sep 17, 2021 1:43 am

colinChan008 wrote:is there a roadmap to support bind to same js object?

No, but you are welcome to implement it and submit a PR (with test coverage).
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Previous

Return to Support Forum

Who is online

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