Bug 1473513 - refactor main.js to use protocol.js pools; r=ochameau

MozReview-Commit-ID: FNMK4f553yI

Depends on D6474

Differential Revision: https://phabricator.services.mozilla.com/D6475

--HG--
extra : moz-landing-system : lando
This commit is contained in:
yulia 2018-09-25 08:05:47 +00:00
Родитель e857119004
Коммит 1ad50b5afe
3 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -44,9 +44,11 @@ add_task(async function() {
const conn = DebuggerServer._connections[connID];
const actorPrefix = conn._prefix + "testOne";
for (let pool of conn._extraPools) {
count += Object.keys(pool._actors).filter(e => {
return e.startsWith(actorPrefix);
}).length;
for (const actor of pool.poolChildren()) {
if (actor.actorID.startsWith(actorPrefix)) {
count++;
}
}
}
}

Просмотреть файл

@ -10,7 +10,7 @@
*/
var { Ci, Cc } = require("chrome");
var Services = require("Services");
var { ActorPool } = require("devtools/server/actors/common");
var { Pool } = require("devtools/shared/protocol");
var { ActorRegistry } = require("devtools/server/actor-registry");
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
var { dumpn } = DevToolsUtils;
@ -981,7 +981,7 @@ function DebuggerServerConnection(prefix, transport) {
this._transport.hooks = this;
this._nextID = 1;
this._actorPool = new ActorPool(this);
this._actorPool = new Pool(this);
this._extraPools = [this._actorPool];
// Responses to a given actor must be returned the the client
@ -1093,14 +1093,14 @@ DebuggerServerConnection.prototype = {
* Add an actor to the default actor pool for this connection.
*/
addActor(actor) {
this._actorPool.addActor(actor);
this._actorPool.manage(actor);
},
/**
* Remove an actor to the default actor pool for this connection.
*/
removeActor(actor) {
this._actorPool.removeActor(actor);
this._actorPool.unmanage(actor);
},
/**

Просмотреть файл

@ -248,8 +248,6 @@ var RootActor = protocol.ActorClassWithSpec(rootSpec, {
this.actorID = "root";
this._children = {};
protocol.Actor.prototype.initialize.call(this, conn);
// Root actor owns itself.
this.manage(this);
},
sayHello: simpleHello,
@ -354,7 +352,7 @@ function run_test() {
let childFront = null;
const expectRootChildren = size => {
Assert.equal(rootActor._poolMap.size, size + 1);
Assert.equal(rootActor._poolMap.size, size);
Assert.equal(rootFront._poolMap.size, size + 1);
if (childFront) {
Assert.equal(childFront._poolMap.size, 0);