зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564134 - Convert ContentProcessTargetActor to protocol.js. r=yulia
Differential Revision: https://phabricator.services.mozilla.com/D37188 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
46a3520d09
Коммит
c44213fae7
|
@ -17,10 +17,13 @@ const Services = require("Services");
|
|||
const { ChromeDebuggerActor } = require("devtools/server/actors/thread");
|
||||
const { WebConsoleActor } = require("devtools/server/actors/webconsole");
|
||||
const makeDebugger = require("devtools/server/actors/utils/make-debugger");
|
||||
const { ActorPool } = require("devtools/server/actors/common");
|
||||
const { Pool } = require("devtools/shared/protocol");
|
||||
const { assert } = require("devtools/shared/DevToolsUtils");
|
||||
const { TabSources } = require("devtools/server/actors/utils/TabSources");
|
||||
const { ActorClassWithSpec, Actor } = require("devtools/shared/protocol");
|
||||
const {
|
||||
contentProcessTargetSpec,
|
||||
} = require("devtools/shared/specs/targets/content-process");
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
|
@ -41,10 +44,10 @@ loader.lazyRequireGetter(
|
|||
true
|
||||
);
|
||||
|
||||
function ContentProcessTargetActor(connection) {
|
||||
const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
|
||||
initialize: function(connection) {
|
||||
Actor.prototype.initialize.call(this, connection);
|
||||
this.conn = connection;
|
||||
this._contextPool = new ActorPool(this.conn);
|
||||
this.conn.addActorPool(this._contextPool);
|
||||
this.threadActor = null;
|
||||
|
||||
// Use a see-everything debugger
|
||||
|
@ -76,11 +79,7 @@ function ContentProcessTargetActor(connection) {
|
|||
this._workerList = null;
|
||||
this._workerTargetActorPool = null;
|
||||
this._onWorkerListChanged = this._onWorkerListChanged.bind(this);
|
||||
}
|
||||
exports.ContentProcessTargetActor = ContentProcessTargetActor;
|
||||
|
||||
ContentProcessTargetActor.prototype = {
|
||||
actorPrefix: "contentProcessTarget",
|
||||
},
|
||||
|
||||
get isRootActor() {
|
||||
return true;
|
||||
|
@ -112,22 +111,22 @@ ContentProcessTargetActor.prototype = {
|
|||
form: function() {
|
||||
if (!this._consoleActor) {
|
||||
this._consoleActor = new WebConsoleActor(this.conn, this);
|
||||
this._contextPool.addActor(this._consoleActor);
|
||||
this.manage(this._consoleActor);
|
||||
}
|
||||
|
||||
if (!this.threadActor) {
|
||||
this.threadActor = new ChromeDebuggerActor(this.conn, this);
|
||||
this._contextPool.addActor(this.threadActor);
|
||||
this.manage(this.threadActor);
|
||||
}
|
||||
if (!this.memoryActor) {
|
||||
this.memoryActor = new MemoryActor(this.conn, this);
|
||||
this._contextPool.addActor(this.memoryActor);
|
||||
this.manage(this.memoryActor);
|
||||
}
|
||||
// Promises actor is being tested by xpcshell test, which uses the content process
|
||||
// target actor. But this actor isn't being used outside of tests yet.
|
||||
if (!this._promisesActor) {
|
||||
this._promisesActor = new PromisesActor(this.conn, this);
|
||||
this._contextPool.addActor(this._promisesActor);
|
||||
this.manage(this._promisesActor);
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -145,7 +144,7 @@ ContentProcessTargetActor.prototype = {
|
|||
};
|
||||
},
|
||||
|
||||
onListWorkers: function() {
|
||||
listWorkers: function() {
|
||||
if (!this._workerList) {
|
||||
this._workerList = new WorkerTargetActorList(this.conn, {});
|
||||
}
|
||||
|
@ -156,7 +155,7 @@ ContentProcessTargetActor.prototype = {
|
|||
}
|
||||
|
||||
// Do not destroy the pool before transfering ownership to the newly created
|
||||
// pool, so that we do not accidently destroy actors that are still in use.
|
||||
// pool, so that we do not accidentally destroy actors that are still in use.
|
||||
if (this._workerTargetActorPool) {
|
||||
this._workerTargetActorPool.destroy();
|
||||
}
|
||||
|
@ -166,7 +165,7 @@ ContentProcessTargetActor.prototype = {
|
|||
|
||||
return {
|
||||
from: this.actorID,
|
||||
workers: actors.map(actor => actor.form()),
|
||||
workers: actors,
|
||||
};
|
||||
});
|
||||
},
|
||||
|
@ -177,8 +176,7 @@ ContentProcessTargetActor.prototype = {
|
|||
},
|
||||
|
||||
destroy: function() {
|
||||
this.conn.removeActorPool(this._contextPool);
|
||||
this._contextPool = null;
|
||||
Actor.prototype.destroy.call(this);
|
||||
|
||||
// Tell the live lists we aren't watching any more.
|
||||
if (this._workerList) {
|
||||
|
@ -193,8 +191,6 @@ ContentProcessTargetActor.prototype = {
|
|||
},
|
||||
|
||||
postNest: function() {},
|
||||
};
|
||||
});
|
||||
|
||||
ContentProcessTargetActor.prototype.requestTypes = {
|
||||
listWorkers: ContentProcessTargetActor.prototype.onListWorkers,
|
||||
};
|
||||
exports.ContentProcessTargetActor = ContentProcessTargetActor;
|
||||
|
|
Загрузка…
Ссылка в новой задаче