From 6a298fd0389ba00fca7cb9a10bb45f9a5e5a59bf Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Wed, 18 Jul 2018 09:00:44 -0700 Subject: [PATCH] Bug 1264873 - Ensure exposing memory actor for the browser content toolbox. r=yulia MozReview-Commit-ID: 3duHXef13M4 --HG-- extra : rebase_source : 8f372fedbbfe59ec7c2756bde61450e67f46345a --- devtools/server/actors/targets/content-process.js | 7 ++++++- devtools/server/performance/memory.js | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/devtools/server/actors/targets/content-process.js b/devtools/server/actors/targets/content-process.js index b95a416926e8..2b9b9b2998f0 100644 --- a/devtools/server/actors/targets/content-process.js +++ b/devtools/server/actors/targets/content-process.js @@ -22,6 +22,7 @@ const { assert } = require("devtools/shared/DevToolsUtils"); const { TabSources } = require("devtools/server/actors/utils/TabSources"); loader.lazyRequireGetter(this, "WorkerTargetActorList", "devtools/server/actors/worker/worker-list", true); +loader.lazyRequireGetter(this, "MemoryActor", "devtools/server/actors/memory", true); function ContentProcessTargetActor(connection) { this.conn = connection; @@ -104,13 +105,17 @@ ContentProcessTargetActor.prototype = { this.threadActor = new ChromeDebuggerActor(this.conn, this); this._contextPool.addActor(this.threadActor); } - + if (!this.memoryActor) { + this.memoryActor = new MemoryActor(this.conn, this); + this._contextPool.addActor(this.memoryActor); + } return { actor: this.actorID, name: "Content process", consoleActor: this._consoleActor.actorID, chromeDebugger: this.threadActor.actorID, + memoryActor: this.memoryActor.actorID, traits: { highlightable: false, diff --git a/devtools/server/performance/memory.js b/devtools/server/performance/memory.js index 64c8d0d328ab..648746dd15b1 100644 --- a/devtools/server/performance/memory.js +++ b/devtools/server/performance/memory.js @@ -418,8 +418,14 @@ Memory.prototype = { * Accesses the docshell to return the current process time. */ _getCurrentTime: function() { - return (this.parent.isRootActor ? this.parent.docShell : - this.parent.originalDocShell).now(); + const docShell = this.parent.isRootActor ? this.parent.docShell : + this.parent.originalDocShell; + if (docShell) { + return docShell.now(); + } + // When used from the ContentProcessTargetActor, parent has no docShell, + // so fallback to Cu.now + return Cu.now(); }, };