diff --git a/toolkit/devtools/debugger/dbg-client.jsm b/toolkit/devtools/debugger/dbg-client.jsm index 8d7995f1714..aa5d747f78b 100644 --- a/toolkit/devtools/debugger/dbg-client.jsm +++ b/toolkit/devtools/debugger/dbg-client.jsm @@ -166,7 +166,8 @@ const ThreadStateTypes = { const UnsolicitedNotifications = { "newScript": "newScript", "tabDetached": "tabDetached", - "tabNavigated": "tabNavigated" + "tabNavigated": "tabNavigated", + "profilerStateChanged": "profilerStateChanged" }; /** diff --git a/toolkit/devtools/debugger/server/dbg-profiler-actors.js b/toolkit/devtools/debugger/server/dbg-profiler-actors.js index ae00a0f27ce..1530b71dd5a 100644 --- a/toolkit/devtools/debugger/server/dbg-profiler-actors.js +++ b/toolkit/devtools/debugger/server/dbg-profiler-actors.js @@ -8,10 +8,15 @@ * Creates a ProfilerActor. ProfilerActor provides remote access to the * built-in profiler module. */ -function ProfilerActor() +function ProfilerActor(aConnection) { + this._conn = aConnection; this._profiler = Cc["@mozilla.org/tools/profiler;1"].getService(Ci.nsIProfiler); this._started = false; + + Cu.import("resource://gre/modules/Services.jsm"); + Services.obs.addObserver(this, "profiler-started", false); + Services.obs.addObserver(this, "profiler-stopped", false); } ProfilerActor.prototype = { @@ -58,7 +63,14 @@ ProfilerActor.prototype = { onGetSharedLibraryInformation: function(aRequest) { var sharedLibraries = this._profiler.getSharedLibraryInformation(); return { "sharedLibraryInformation": sharedLibraries } - } + }, + observe: function(aSubject, aTopic, aData) { + if (aTopic == "profiler-started") { + this.conn.send({ from: this.actorID, type: "profilerStateChanged", isActive: true }); + } else if (aTopic == "profiler-stopped") { + this.conn.send({ from: this.actorID, type: "profilerStateChanged", isActive: false }); + } + }, }; /**