зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
e857119004
Коммит
1ad50b5afe
|
@ -44,9 +44,11 @@ add_task(async function() {
|
||||||
const conn = DebuggerServer._connections[connID];
|
const conn = DebuggerServer._connections[connID];
|
||||||
const actorPrefix = conn._prefix + "testOne";
|
const actorPrefix = conn._prefix + "testOne";
|
||||||
for (let pool of conn._extraPools) {
|
for (let pool of conn._extraPools) {
|
||||||
count += Object.keys(pool._actors).filter(e => {
|
for (const actor of pool.poolChildren()) {
|
||||||
return e.startsWith(actorPrefix);
|
if (actor.actorID.startsWith(actorPrefix)) {
|
||||||
}).length;
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*/
|
*/
|
||||||
var { Ci, Cc } = require("chrome");
|
var { Ci, Cc } = require("chrome");
|
||||||
var Services = require("Services");
|
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 { ActorRegistry } = require("devtools/server/actor-registry");
|
||||||
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||||
var { dumpn } = DevToolsUtils;
|
var { dumpn } = DevToolsUtils;
|
||||||
|
@ -981,7 +981,7 @@ function DebuggerServerConnection(prefix, transport) {
|
||||||
this._transport.hooks = this;
|
this._transport.hooks = this;
|
||||||
this._nextID = 1;
|
this._nextID = 1;
|
||||||
|
|
||||||
this._actorPool = new ActorPool(this);
|
this._actorPool = new Pool(this);
|
||||||
this._extraPools = [this._actorPool];
|
this._extraPools = [this._actorPool];
|
||||||
|
|
||||||
// Responses to a given actor must be returned the the client
|
// 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.
|
* Add an actor to the default actor pool for this connection.
|
||||||
*/
|
*/
|
||||||
addActor(actor) {
|
addActor(actor) {
|
||||||
this._actorPool.addActor(actor);
|
this._actorPool.manage(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an actor to the default actor pool for this connection.
|
* Remove an actor to the default actor pool for this connection.
|
||||||
*/
|
*/
|
||||||
removeActor(actor) {
|
removeActor(actor) {
|
||||||
this._actorPool.removeActor(actor);
|
this._actorPool.unmanage(actor);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -248,8 +248,6 @@ var RootActor = protocol.ActorClassWithSpec(rootSpec, {
|
||||||
this.actorID = "root";
|
this.actorID = "root";
|
||||||
this._children = {};
|
this._children = {};
|
||||||
protocol.Actor.prototype.initialize.call(this, conn);
|
protocol.Actor.prototype.initialize.call(this, conn);
|
||||||
// Root actor owns itself.
|
|
||||||
this.manage(this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
sayHello: simpleHello,
|
sayHello: simpleHello,
|
||||||
|
@ -354,7 +352,7 @@ function run_test() {
|
||||||
let childFront = null;
|
let childFront = null;
|
||||||
|
|
||||||
const expectRootChildren = size => {
|
const expectRootChildren = size => {
|
||||||
Assert.equal(rootActor._poolMap.size, size + 1);
|
Assert.equal(rootActor._poolMap.size, size);
|
||||||
Assert.equal(rootFront._poolMap.size, size + 1);
|
Assert.equal(rootFront._poolMap.size, size + 1);
|
||||||
if (childFront) {
|
if (childFront) {
|
||||||
Assert.equal(childFront._poolMap.size, 0);
|
Assert.equal(childFront._poolMap.size, 0);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче