Bug 1573779 - [devtools] Rename WorkerTargetActorList to WorkerDescriptorActorList. r=jdescottes.

This class is creating (and handling) WorkerDescriptorActor now, so we rename
it to make it explicit.

Differential Revision: https://phabricator.services.mozilla.com/D91557
This commit is contained in:
Nicolas Chevobbe 2020-09-29 01:54:32 +00:00
parent 4914f8c614
commit bda0dabd83
7 changed files with 52 additions and 49 deletions

View File

@ -218,8 +218,8 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
if (this._addonTargetActorPool) {
this._addonTargetActorPool.destroy();
}
if (this._workerTargetActorPool) {
this._workerTargetActorPool.destroy();
if (this._workerDescriptorActorPool) {
this._workerDescriptorActorPool.destroy();
}
if (this._frameDescriptorActorPool) {
this._frameDescriptorActorPool.destroy();
@ -426,11 +426,11 @@ exports.RootActor = protocol.ActorClassWithSpec(rootSpec, {
// 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.
if (this._workerTargetActorPool) {
this._workerTargetActorPool.destroy();
if (this._workerDescriptorActorPool) {
this._workerDescriptorActorPool.destroy();
}
this._workerTargetActorPool = pool;
this._workerDescriptorActorPool = pool;
return {
workers: actors,

View File

@ -58,8 +58,8 @@ loader.lazyRequireGetter(
);
loader.lazyRequireGetter(
this,
"WorkerTargetActorList",
"devtools/server/actors/worker/worker-target-actor-list",
"WorkerDescriptorActorList",
"devtools/server/actors/worker/worker-descriptor-actor-list",
true
);
loader.lazyImporter(this, "ExtensionContent", EXTENSION_CONTENT_JSM);
@ -294,9 +294,9 @@ const browsingContextTargetPrototype = {
navigation: true,
};
this._workerTargetActorList = null;
this._workerTargetActorPool = null;
this._onWorkerTargetActorListChanged = this._onWorkerTargetActorListChanged.bind(
this._workerDescriptorActorList = null;
this._workerDescriptorActorPool = null;
this._onWorkerDescriptorActorListChanged = this._onWorkerDescriptorActorListChanged.bind(
this
);
this.notifyResourceAvailable = this.notifyResourceAvailable.bind(this);
@ -744,18 +744,21 @@ const browsingContextTargetPrototype = {
return { frames: windows };
},
ensureWorkerTargetActorList() {
if (this._workerTargetActorList === null) {
this._workerTargetActorList = new WorkerTargetActorList(this.conn, {
type: Ci.nsIWorkerDebugger.TYPE_DEDICATED,
window: this.window,
});
ensureWorkerDescriptorActorList() {
if (this._workerDescriptorActorList === null) {
this._workerDescriptorActorList = new WorkerDescriptorActorList(
this.conn,
{
type: Ci.nsIWorkerDebugger.TYPE_DEDICATED,
window: this.window,
}
);
}
return this._workerTargetActorList;
return this._workerDescriptorActorList;
},
pauseWorkersUntilAttach(shouldPause) {
this.ensureWorkerTargetActorList().workerPauser.setPauseMatching(
this.ensureWorkerDescriptorActorList().workerPauser.setPauseMatching(
shouldPause
);
},
@ -767,7 +770,7 @@ const browsingContextTargetPrototype = {
};
}
return this.ensureWorkerTargetActorList()
return this.ensureWorkerDescriptorActorList()
.getList()
.then(actors => {
const pool = new Pool(this.conn, "worker-targets");
@ -777,12 +780,12 @@ const browsingContextTargetPrototype = {
// 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.
if (this._workerTargetActorPool) {
this._workerTargetActorPool.destroy();
if (this._workerDescriptorActorPool) {
this._workerDescriptorActorPool.destroy();
}
this._workerTargetActorPool = pool;
this._workerTargetActorList.onListChanged = this._onWorkerTargetActorListChanged;
this._workerDescriptorActorPool = pool;
this._workerDescriptorActorList.onListChanged = this._onWorkerDescriptorActorListChanged;
return {
workers: actors,
@ -808,8 +811,8 @@ const browsingContextTargetPrototype = {
return {};
},
_onWorkerTargetActorListChanged() {
this._workerTargetActorList.onListChanged = null;
_onWorkerDescriptorActorListChanged() {
this._workerDescriptorActorList.onListChanged = null;
this.emit("workerListChanged");
},
@ -1050,14 +1053,14 @@ const browsingContextTargetPrototype = {
}
// Make sure that no more workerListChanged notifications are sent.
if (this._workerTargetActorList !== null) {
this._workerTargetActorList.destroy();
this._workerTargetActorList = null;
if (this._workerDescriptorActorList !== null) {
this._workerDescriptorActorList.destroy();
this._workerDescriptorActorList = null;
}
if (this._workerTargetActorPool !== null) {
this._workerTargetActorPool.destroy();
this._workerTargetActorPool = null;
if (this._workerDescriptorActorPool !== null) {
this._workerDescriptorActorPool.destroy();
this._workerDescriptorActorPool = null;
}
if (this._dbg) {

View File

@ -28,8 +28,8 @@ const Targets = require("devtools/server/actors/targets/index");
loader.lazyRequireGetter(
this,
"WorkerTargetActorList",
"devtools/server/actors/worker/worker-target-actor-list",
"WorkerDescriptorActorList",
"devtools/server/actors/worker/worker-descriptor-actor-list",
true
);
loader.lazyRequireGetter(
@ -72,7 +72,7 @@ const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
this._consoleScope = sandbox;
this._workerList = null;
this._workerTargetActorPool = null;
this._workerDescriptorActorPool = null;
this._onWorkerListChanged = this._onWorkerListChanged.bind(this);
// Try to destroy the Content Process Target when the content process shuts down.
@ -155,7 +155,7 @@ const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
ensureWorkerList() {
if (!this._workerList) {
this._workerList = new WorkerTargetActorList(this.conn, {});
this._workerList = new WorkerDescriptorActorList(this.conn, {});
}
return this._workerList;
},
@ -171,11 +171,11 @@ const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
// Do not destroy the pool before transfering ownership to the newly created
// pool, so that we do not accidentally destroy actors that are still in use.
if (this._workerTargetActorPool) {
this._workerTargetActorPool.destroy();
if (this._workerDescriptorActorPool) {
this._workerDescriptorActorPool.destroy();
}
this._workerTargetActorPool = pool;
this._workerDescriptorActorPool = pool;
this._workerList.onListChanged = this._onWorkerListChanged;
return {

View File

@ -30,8 +30,8 @@ loader.lazyRequireGetter(
);
loader.lazyRequireGetter(
this,
"WorkerTargetActorList",
"devtools/server/actors/worker/worker-target-actor-list",
"WorkerDescriptorActorList",
"devtools/server/actors/worker/worker-descriptor-actor-list",
true
);
loader.lazyRequireGetter(
@ -94,7 +94,7 @@ exports.createRootActor = function createRootActor(connection) {
return new RootActor(connection, {
tabList: new BrowserTabList(connection),
addonList: new BrowserAddonList(connection),
workerList: new WorkerTargetActorList(connection, {}),
workerList: new WorkerDescriptorActorList(connection, {}),
serviceWorkerRegistrationList: new ServiceWorkerRegistrationActorList(
connection
),

View File

@ -10,5 +10,5 @@ DevToolsModules(
'service-worker-registration-list.js',
'service-worker-registration.js',
'service-worker.js',
'worker-target-actor-list.js',
'worker-descriptor-actor-list.js',
)

View File

@ -48,7 +48,7 @@ function matchServiceWorker(dbg, origin) {
// When a new worker appears, in some cases (i.e. the debugger is running) we
// want it to pause during registration until a later time (i.e. the debugger
// finishes attaching to the worker). This is an optional WorkderDebuggerManager
// listener that can be installed in addition to the WorkerTargetActorList
// listener that can be installed in addition to the WorkerDescriptorActorList
// listener. It always listens to new workers and pauses any matching filters
// which have been set on it.
//
@ -60,7 +60,7 @@ function matchServiceWorker(dbg, origin) {
// setPauseServiceWorkers(origin) will pause all service workers which have the
// specified origin.
//
// FIXME Bug 1601279 separate WorkerPauser from WorkerTargetActorList and give
// FIXME Bug 1601279 separate WorkerPauser from WorkerDescriptorActorList and give
// it a more consistent interface.
function WorkerPauser(options) {
this._options = options;
@ -99,7 +99,7 @@ WorkerPauser.prototype = {
},
};
function WorkerTargetActorList(conn, options) {
function WorkerDescriptorActorList(conn, options) {
this._conn = conn;
this._options = options;
this._actors = new Map();
@ -110,7 +110,7 @@ function WorkerTargetActorList(conn, options) {
this.onUnregister = this.onUnregister.bind(this);
}
WorkerTargetActorList.prototype = {
WorkerDescriptorActorList.prototype = {
destroy() {
this.onListChanged = null;
if (this._workerPauser) {
@ -209,4 +209,4 @@ WorkerTargetActorList.prototype = {
},
};
exports.WorkerTargetActorList = WorkerTargetActorList;
exports.WorkerDescriptorActorList = WorkerDescriptorActorList;

View File

@ -23,7 +23,7 @@ const {
ServiceWorkerRegistrationActorList,
} = require("devtools/server/actors/worker/service-worker-registration-list");
const {
WorkerTargetActorList,
WorkerDescriptorActorList,
} = require("devtools/server/actors/worker/worker-target-actor-list");
const { ProcessActorList } = require("devtools/server/actors/process");
@ -43,7 +43,7 @@ exports.createRootActor = function createRootActor(aConnection) {
const parameters = {
tabList: new MobileTabList(aConnection),
addonList: new BrowserAddonList(aConnection),
workerList: new WorkerTargetActorList(aConnection, {}),
workerList: new WorkerDescriptorActorList(aConnection, {}),
serviceWorkerRegistrationList: new ServiceWorkerRegistrationActorList(
aConnection
),