when I bind a C++ object to v8, it will be different v8 object in v8 that will make a confuse while we compare the v8 objects to make a logic.
Is there a way to perform SetWeak/ClearWeak on a CEFV8Value? That would solve the problem.
struct UserData : public CefBaseRefCounted
{
UserData(void* _data)
: data(_data)
{
}
~RefUserData()
{
if (data) delete (A*)data;
}
void * data;
IMPLEMENT_REFCOUNTING(UserData);
};
class A{};
void create(CefRefPtr<CefV8Value>& retval){
static A * value= new A();
CefRefPtr<CefV8Value> retval = CefV8Value::CreateObject(&*Class<A>::classAccessor, nullptr);
retval->SetUserData(new UserData(value));
setGettersAndMethods(retval, value);
}
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.
Users browsing this forum: Google [Bot] and 100 guests