feat: add process.takeHeapSnapshot() / webContents.takeHeapSnapshot() (#14456)
This commit is contained in:
parent
1855144d26
commit
e22142ef9c
17 changed files with 262 additions and 5 deletions
|
@ -160,6 +160,22 @@ WebContents.prototype.executeJavaScript = function (code, hasUserGesture, callba
|
|||
}
|
||||
}
|
||||
|
||||
WebContents.prototype.takeHeapSnapshot = function (filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const channel = `ELECTRON_TAKE_HEAP_SNAPSHOT_RESULT_${getNextId()}`
|
||||
ipcMain.once(channel, (event, success) => {
|
||||
if (success) {
|
||||
resolve()
|
||||
} else {
|
||||
reject(new Error('takeHeapSnapshot failed'))
|
||||
}
|
||||
})
|
||||
if (!this._takeHeapSnapshot(filePath, channel)) {
|
||||
ipcMain.emit(channel, false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Translate the options of printToPDF.
|
||||
WebContents.prototype.printToPDF = function (options, callback) {
|
||||
const printingSetting = Object.assign({}, defaultPrintingSetting)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue