Skip to content

Commit

Permalink
fix: takeHeapSnapshot() using public IPC channel for internal impleme…
Browse files Browse the repository at this point in the history
…ntation (#16480)
  • Loading branch information
miniak authored and Cheng Zhao committed Jan 22, 2019
1 parent 0e27f13 commit 7d71ad6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion atom/renderer/atom_render_frame_observer.cc
Expand Up @@ -216,7 +216,7 @@ void AtomRenderFrameObserver::OnTakeHeapSnapshot(
args.AppendBoolean(success);

render_frame_->Send(new AtomFrameHostMsg_Message(
render_frame_->GetRoutingID(), "ipc-message", args));
render_frame_->GetRoutingID(), "ipc-internal-message", args));
}

void AtomRenderFrameObserver::EmitIPCEvent(blink::WebLocalFrame* frame,
Expand Down
4 changes: 2 additions & 2 deletions lib/browser/api/web-contents.js
Expand Up @@ -237,15 +237,15 @@ WebContents.prototype.getZoomFactor = function (callback) {
WebContents.prototype.takeHeapSnapshot = function (filePath) {
return new Promise((resolve, reject) => {
const channel = `ELECTRON_TAKE_HEAP_SNAPSHOT_RESULT_${getNextId()}`
ipcMain.once(channel, (event, success) => {
ipcMainInternal.once(channel, (event, success) => {
if (success) {
resolve()
} else {
reject(new Error('takeHeapSnapshot failed'))
}
})
if (!this._takeHeapSnapshot(filePath, channel)) {
ipcMain.emit(channel, false)
ipcMainInternal.emit(channel, false)
}
})
}
Expand Down

0 comments on commit 7d71ad6

Please sign in to comment.