-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove RefBase (nodejs/node#53590)
- Loading branch information
1 parent
414439f
commit f08c821
Showing
18 changed files
with
293 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,49 @@ | ||
import type { Env } from './env' | ||
|
||
export class Finalizer { | ||
private _makeDynCall_vppp: (cb: Ptr) => (a: Ptr, b: Ptr, c: Ptr) => void | ||
|
||
public constructor ( | ||
public envObject: Env, | ||
protected _finalizeCallback: napi_finalize = 0, | ||
protected _finalizeData: void_p = 0, | ||
protected _finalizeHint: void_p = 0 | ||
) {} | ||
private _finalizeCallback: napi_finalize = 0, | ||
private _finalizeData: void_p = 0, | ||
private _finalizeHint: void_p = 0 | ||
) { | ||
this._makeDynCall_vppp = envObject.makeDynCall_vppp | ||
} | ||
|
||
public callback (): napi_finalize { return this._finalizeCallback } | ||
public data (): void_p { return this._finalizeData } | ||
public hint (): void_p { return this._finalizeHint } | ||
|
||
public resetEnv (): void { | ||
this.envObject = undefined! | ||
} | ||
|
||
public resetFinalizer (): void { | ||
this._finalizeCallback = 0 | ||
this._finalizeData = 0 | ||
this._finalizeHint = 0 | ||
} | ||
|
||
public callFinalizer (): void { | ||
const finalize_callback = this._finalizeCallback | ||
const finalize_data = this._finalizeData | ||
const finalize_hint = this._finalizeHint | ||
this.resetFinalizer() | ||
|
||
if (!finalize_callback) return | ||
|
||
const fini = Number(finalize_callback) | ||
if (!this.envObject) { | ||
this._makeDynCall_vppp(fini)(0, finalize_data, finalize_hint) | ||
} else { | ||
this.envObject.callFinalizer(fini, finalize_data, finalize_hint) | ||
} | ||
} | ||
|
||
public dispose (): void { | ||
this.envObject = undefined! | ||
this._makeDynCall_vppp = undefined! | ||
} | ||
} |
Oops, something went wrong.