Dereference remote objects with native code
Previously we rely on the v8util.setDestructor to dereference the remote objects in JavaScript, however as documented in V8, it is forbidden to call V8 APIs in object's destructor (e.g. the weak callback), and doing so would result in crashs. This commit removes the JavaScript setDestructor method, and avoids doing the dereference work with V8.
This commit is contained in:
parent
570dc7ca9b
commit
06cf0406fe
12 changed files with 272 additions and 61 deletions
|
@ -210,9 +210,7 @@ let metaToValue = function (meta) {
|
|||
|
||||
// Track delegate object's life time, and tell the browser to clean up
|
||||
// when the object is GCed.
|
||||
v8Util.setDestructor(ret, function () {
|
||||
ipcRenderer.send('ELECTRON_BROWSER_DEREFERENCE', meta.id)
|
||||
})
|
||||
v8Util.setRemoteObjectFreer(ret, meta.id)
|
||||
|
||||
// Remember object's id.
|
||||
v8Util.setHiddenValue(ret, 'atomId', meta.id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue