mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 1395029 - Use blockThreadedExecution for debugging (r=jimb)
MozReview-Commit-ID: 2KRXZrTulwU
This commit is contained in:
parent
79162c692a
commit
51c04f774f
@ -35,25 +35,34 @@ try {
|
||||
let prefix = msg.data.prefix;
|
||||
let addonId = msg.data.addonId;
|
||||
|
||||
let conn = DebuggerServer.connectToParent(prefix, mm);
|
||||
conn.parentMessageManager = mm;
|
||||
connections.set(prefix, conn);
|
||||
// Using the JS debugger causes problems when we're trying to
|
||||
// schedule those zone groups across different threads. Calling
|
||||
// blockThreadedExecution causes Gecko to switch to a simpler
|
||||
// single-threaded model until unblockThreadedExecution is
|
||||
// called later. We cannot start the debugger until the callback
|
||||
// passed to blockThreadedExecution has run, signaling that
|
||||
// we're running single-threaded.
|
||||
Cu.blockThreadedExecution(() => {
|
||||
let conn = DebuggerServer.connectToParent(prefix, mm);
|
||||
conn.parentMessageManager = mm;
|
||||
connections.set(prefix, conn);
|
||||
|
||||
let actor;
|
||||
let actor;
|
||||
|
||||
if (addonId) {
|
||||
const { WebExtensionChildActor } = require("devtools/server/actors/webextension");
|
||||
actor = new WebExtensionChildActor(conn, chromeGlobal, prefix, addonId);
|
||||
} else {
|
||||
const { ContentActor } = require("devtools/server/actors/childtab");
|
||||
actor = new ContentActor(conn, chromeGlobal, prefix);
|
||||
}
|
||||
if (addonId) {
|
||||
const { WebExtensionChildActor } = require("devtools/server/actors/webextension");
|
||||
actor = new WebExtensionChildActor(conn, chromeGlobal, prefix, addonId);
|
||||
} else {
|
||||
const { ContentActor } = require("devtools/server/actors/childtab");
|
||||
actor = new ContentActor(conn, chromeGlobal, prefix);
|
||||
}
|
||||
|
||||
let actorPool = new ActorPool(conn);
|
||||
actorPool.addActor(actor);
|
||||
conn.addActorPool(actorPool);
|
||||
let actorPool = new ActorPool(conn);
|
||||
actorPool.addActor(actor);
|
||||
conn.addActorPool(actorPool);
|
||||
|
||||
sendAsyncMessage("debug:actor", {actor: actor.form(), prefix: prefix});
|
||||
sendAsyncMessage("debug:actor", {actor: actor.form(), prefix: prefix});
|
||||
});
|
||||
});
|
||||
|
||||
addMessageListener("debug:connect", onConnect);
|
||||
@ -100,6 +109,8 @@ try {
|
||||
return;
|
||||
}
|
||||
|
||||
Cu.unblockThreadedExecution();
|
||||
|
||||
removeMessageListener("debug:disconnect", onDisconnect);
|
||||
// Call DebuggerServerConnection.close to destroy all child actors. It should end up
|
||||
// calling DebuggerServerConnection.onClosed that would actually cleanup all actor
|
||||
|
@ -41,6 +41,8 @@ function setupServer(mm) {
|
||||
mm.addMessageListener("debug:content-process-destroy", function onDestroy() {
|
||||
mm.removeMessageListener("debug:content-process-destroy", onDestroy);
|
||||
|
||||
Cu.unblockThreadedExecution();
|
||||
|
||||
DebuggerServer.destroy();
|
||||
gLoader.destroy();
|
||||
gLoader = null;
|
||||
@ -54,23 +56,32 @@ function init(msg) {
|
||||
mm.QueryInterface(Ci.nsISyncMessageSender);
|
||||
let prefix = msg.data.prefix;
|
||||
|
||||
// Setup a server if none started yet
|
||||
let loader = setupServer(mm);
|
||||
// Using the JS debugger causes problems when we're trying to
|
||||
// schedule those zone groups across different threads. Calling
|
||||
// blockThreadedExecution causes Gecko to switch to a simpler
|
||||
// single-threaded model until unblockThreadedExecution is called
|
||||
// later. We cannot start the debugger until the callback passed to
|
||||
// blockThreadedExecution has run, signaling that we're running
|
||||
// single-threaded.
|
||||
Cu.blockThreadedExecution(() => {
|
||||
// Setup a server if none started yet
|
||||
let loader = setupServer(mm);
|
||||
|
||||
// Connect both parent/child processes debugger servers RDP via message
|
||||
// managers
|
||||
let { DebuggerServer } = loader.require("devtools/server/main");
|
||||
let conn = DebuggerServer.connectToParent(prefix, mm);
|
||||
conn.parentMessageManager = mm;
|
||||
// Connect both parent/child processes debugger servers RDP via message
|
||||
// managers
|
||||
let { DebuggerServer } = loader.require("devtools/server/main");
|
||||
let conn = DebuggerServer.connectToParent(prefix, mm);
|
||||
conn.parentMessageManager = mm;
|
||||
|
||||
let { ChildProcessActor } =
|
||||
loader.require("devtools/server/actors/child-process");
|
||||
let { ActorPool } = loader.require("devtools/server/main");
|
||||
let actor = new ChildProcessActor(conn);
|
||||
let actorPool = new ActorPool(conn);
|
||||
actorPool.addActor(actor);
|
||||
conn.addActorPool(actorPool);
|
||||
let { ChildProcessActor } =
|
||||
loader.require("devtools/server/actors/child-process");
|
||||
let { ActorPool } = loader.require("devtools/server/main");
|
||||
let actor = new ChildProcessActor(conn);
|
||||
let actorPool = new ActorPool(conn);
|
||||
actorPool.addActor(actor);
|
||||
conn.addActorPool(actorPool);
|
||||
|
||||
let response = { actor: actor.form() };
|
||||
mm.sendAsyncMessage("debug:content-process-actor", response);
|
||||
let response = { actor: actor.form() };
|
||||
mm.sendAsyncMessage("debug:content-process-actor", response);
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user