fix: takeHeapSnapshot() using public IPC channel for internal implementation (#16480)

This commit is contained in:
Milan Burda 2019-01-22 09:32:24 +01:00 committed by Cheng Zhao
parent 0e27f133d7
commit 7d71ad6f91
2 changed files with 3 additions and 3 deletions

View file

@ -216,7 +216,7 @@ void AtomRenderFrameObserver::OnTakeHeapSnapshot(
args.AppendBoolean(success); args.AppendBoolean(success);
render_frame_->Send(new AtomFrameHostMsg_Message( 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, void AtomRenderFrameObserver::EmitIPCEvent(blink::WebLocalFrame* frame,

View file

@ -237,7 +237,7 @@ WebContents.prototype.getZoomFactor = function (callback) {
WebContents.prototype.takeHeapSnapshot = function (filePath) { WebContents.prototype.takeHeapSnapshot = function (filePath) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const channel = `ELECTRON_TAKE_HEAP_SNAPSHOT_RESULT_${getNextId()}` const channel = `ELECTRON_TAKE_HEAP_SNAPSHOT_RESULT_${getNextId()}`
ipcMain.once(channel, (event, success) => { ipcMainInternal.once(channel, (event, success) => {
if (success) { if (success) {
resolve() resolve()
} else { } else {
@ -245,7 +245,7 @@ WebContents.prototype.takeHeapSnapshot = function (filePath) {
} }
}) })
if (!this._takeHeapSnapshot(filePath, channel)) { if (!this._takeHeapSnapshot(filePath, channel)) {
ipcMain.emit(channel, false) ipcMainInternal.emit(channel, false)
} }
}) })
} }