зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1866814 - [devtools] Rename WatcherRegistry to ParentProcessWatcherRegistry. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D204872
This commit is contained in:
Родитель
3e7ed5e841
Коммит
27f27a747b
|
@ -9,9 +9,9 @@ const { isWindowGlobalPartOfContext } = ChromeUtils.importESModule(
|
|||
"resource://devtools/server/actors/watcher/browsing-context-helpers.sys.mjs",
|
||||
{ global: "contextual" }
|
||||
);
|
||||
const { WatcherRegistry } = ChromeUtils.importESModule(
|
||||
"resource://devtools/server/actors/watcher/WatcherRegistry.sys.mjs",
|
||||
// WatcherRegistry needs to be a true singleton and loads ActorManagerParent
|
||||
const { ParentProcessWatcherRegistry } = ChromeUtils.importESModule(
|
||||
"resource://devtools/server/actors/watcher/ParentProcessWatcherRegistry.sys.mjs",
|
||||
// ParentProcessWatcherRegistry needs to be a true singleton and loads ActorManagerParent
|
||||
// which also has to be a true singleton.
|
||||
{ global: "shared" }
|
||||
);
|
||||
|
@ -253,7 +253,7 @@ class NetworkEventWatcher {
|
|||
// (i.e. the process where this Watcher runs)
|
||||
const isParentProcessOnlyBrowserToolbox =
|
||||
this.watcherActor.sessionContext.type == "all" &&
|
||||
!WatcherRegistry.isWatchingTargets(
|
||||
!ParentProcessWatcherRegistry.isWatchingTargets(
|
||||
this.watcherActor,
|
||||
Targets.TYPES.FRAME
|
||||
);
|
||||
|
|
|
@ -11,9 +11,9 @@ const { TargetActorRegistry } = ChromeUtils.importESModule(
|
|||
"resource://devtools/server/actors/targets/target-actor-registry.sys.mjs",
|
||||
{ global: "shared" }
|
||||
);
|
||||
const { WatcherRegistry } = ChromeUtils.importESModule(
|
||||
"resource://devtools/server/actors/watcher/WatcherRegistry.sys.mjs",
|
||||
// WatcherRegistry needs to be a true singleton and loads ActorManagerParent
|
||||
const { ParentProcessWatcherRegistry } = ChromeUtils.importESModule(
|
||||
"resource://devtools/server/actors/watcher/ParentProcessWatcherRegistry.sys.mjs",
|
||||
// ParentProcessWatcherRegistry needs to be a true singleton and loads ActorManagerParent
|
||||
// which also has to be a true singleton.
|
||||
{ global: "shared" }
|
||||
);
|
||||
|
@ -164,7 +164,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
// Only try to notify content processes if the watcher was in the registry.
|
||||
// Otherwise it means that it wasn't connected to any process and the JS Process Actor
|
||||
// wouldn't be registered.
|
||||
if (WatcherRegistry.getWatcher(this.actorID)) {
|
||||
if (ParentProcessWatcherRegistry.getWatcher(this.actorID)) {
|
||||
// Emit one IPC message on destroy to all the processes
|
||||
const domProcesses = ChromeUtils.getAllDOMProcesses();
|
||||
for (const domProcess of domProcesses) {
|
||||
|
@ -180,7 +180,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
Resources.getParentProcessResourceTypes(Object.values(Resources.TYPES))
|
||||
);
|
||||
|
||||
WatcherRegistry.unregisterWatcher(this.actorID);
|
||||
ParentProcessWatcherRegistry.unregisterWatcher(this.actorID);
|
||||
|
||||
// In case the watcher actor is leaked, prevent leaking the browser window
|
||||
this._browserElement = null;
|
||||
|
@ -198,7 +198,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
* Returns the list of currently watched resource types.
|
||||
*/
|
||||
get sessionData() {
|
||||
return WatcherRegistry.getSessionData(this);
|
||||
return ParentProcessWatcherRegistry.getSessionData(this);
|
||||
}
|
||||
|
||||
form() {
|
||||
|
@ -227,7 +227,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
* Type of context to observe. See Targets.TYPES object.
|
||||
*/
|
||||
async watchTargets(targetType) {
|
||||
WatcherRegistry.watchTargets(this, targetType);
|
||||
ParentProcessWatcherRegistry.watchTargets(this, targetType);
|
||||
|
||||
// When debugging a tab, ensure processing the top level target first
|
||||
// (for now, other session context types are instantiating the top level target
|
||||
|
@ -277,7 +277,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
* true when this is called as the result of a change to the devtools.browsertoolbox.scope pref
|
||||
*/
|
||||
unwatchTargets(targetType, options = {}) {
|
||||
const isWatchingTargets = WatcherRegistry.unwatchTargets(
|
||||
const isWatchingTargets = ParentProcessWatcherRegistry.unwatchTargets(
|
||||
this,
|
||||
targetType,
|
||||
options
|
||||
|
@ -299,7 +299,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
// unless we're switching mode (having both condition at the same time should only
|
||||
// happen in tests).
|
||||
if (!options.isModeSwitching) {
|
||||
WatcherRegistry.maybeUnregisterJSActors();
|
||||
ParentProcessWatcherRegistry.maybeUnregisterJSActors();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -549,13 +549,13 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
);
|
||||
|
||||
// Bail out early if all resources were watched from parent process.
|
||||
// In this scenario, we do not need to update these resource types in the WatcherRegistry
|
||||
// In this scenario, we do not need to update these resource types in the ParentProcessWatcherRegistry
|
||||
// as targets do not care about them.
|
||||
if (!Resources.hasResourceTypesForTargets(resourceTypes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
WatcherRegistry.watchResources(this, resourceTypes);
|
||||
ParentProcessWatcherRegistry.watchResources(this, resourceTypes);
|
||||
|
||||
const promises = [];
|
||||
const domProcesses = ChromeUtils.getAllDOMProcesses();
|
||||
|
@ -624,13 +624,13 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
);
|
||||
|
||||
// Bail out early if all resources were all watched from parent process.
|
||||
// In this scenario, we do not need to update these resource types in the WatcherRegistry
|
||||
// In this scenario, we do not need to update these resource types in the ParentProcessWatcherRegistry
|
||||
// as targets do not care about them.
|
||||
if (!Resources.hasResourceTypesForTargets(resourceTypes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isWatchingResources = WatcherRegistry.unwatchResources(
|
||||
const isWatchingResources = ParentProcessWatcherRegistry.unwatchResources(
|
||||
this,
|
||||
resourceTypes
|
||||
);
|
||||
|
@ -663,7 +663,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
}
|
||||
|
||||
// Unregister the JS Window Actor if there is no more DevTools code observing any target/resource
|
||||
WatcherRegistry.maybeUnregisterJSActors();
|
||||
ParentProcessWatcherRegistry.maybeUnregisterJSActors();
|
||||
}
|
||||
|
||||
clearResources(resourceTypes) {
|
||||
|
@ -758,7 +758,12 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
* "set" will update the data set with the new entries.
|
||||
*/
|
||||
async addOrSetDataEntry(type, entries, updateType) {
|
||||
WatcherRegistry.addOrSetSessionDataEntry(this, type, entries, updateType);
|
||||
ParentProcessWatcherRegistry.addOrSetSessionDataEntry(
|
||||
this,
|
||||
type,
|
||||
entries,
|
||||
updateType
|
||||
);
|
||||
|
||||
const promises = [];
|
||||
const domProcesses = ChromeUtils.getAllDOMProcesses();
|
||||
|
@ -803,7 +808,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
* List of values to remove from this data type.
|
||||
*/
|
||||
removeDataEntry(type, entries) {
|
||||
WatcherRegistry.removeSessionDataEntry(this, type, entries);
|
||||
ParentProcessWatcherRegistry.removeSessionDataEntry(this, type, entries);
|
||||
|
||||
const domProcesses = ChromeUtils.getAllDOMProcesses();
|
||||
for (const domProcess of domProcesses) {
|
||||
|
@ -847,7 +852,7 @@ exports.WatcherActor = class WatcherActor extends Actor {
|
|||
host = new URL(newTargetUrl).host;
|
||||
} catch (e) {}
|
||||
|
||||
WatcherRegistry.addOrSetSessionDataEntry(
|
||||
ParentProcessWatcherRegistry.addOrSetSessionDataEntry(
|
||||
this,
|
||||
"browser-element-host",
|
||||
[host],
|
||||
|
|
|
@ -67,7 +67,7 @@ function persistMapToSharedData() {
|
|||
Services.ppmm.sharedData.flush();
|
||||
}
|
||||
|
||||
export const WatcherRegistry = {
|
||||
export const ParentProcessWatcherRegistry = {
|
||||
/**
|
||||
* Tells if a given watcher currently watches for a given target type.
|
||||
*
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Helper module alongside WatcherRegistry, which focus on updating the "sessionData" object.
|
||||
* Helper module alongside ParentProcessWatcherRegistry, which focus on updating the "sessionData" object.
|
||||
* This object is shared across processes and threads and have to be maintained in all these runtimes.
|
||||
*/
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
DevToolsModules(
|
||||
"browsing-context-helpers.sys.mjs",
|
||||
"ParentProcessWatcherRegistry.sys.mjs",
|
||||
"session-context.js",
|
||||
"SessionDataHelpers.sys.mjs",
|
||||
"WatcherRegistry.sys.mjs",
|
||||
)
|
||||
|
|
|
@ -24,7 +24,7 @@ const SHARED_DATA_KEY_NAME = "DevTools:watchedPerWatcher";
|
|||
// The main attribute of interest is the `sessionData` one which is set alongside
|
||||
// various other attributes necessary to maintain state per watcher in the content process.
|
||||
//
|
||||
// The Session Data object is maintained by WatcherRegistry, in the parent process
|
||||
// The Session Data object is maintained by ParentProcessWatcherRegistry, in the parent process
|
||||
// and is fetched from the content process via `sharedData` API.
|
||||
// It is then manually maintained via DevToolsProcess JS Actor queries.
|
||||
let gAllWatcherData = null;
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
import { loader } from "resource://devtools/shared/loader/Loader.sys.mjs";
|
||||
import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
|
||||
|
||||
const { WatcherRegistry } = ChromeUtils.importESModule(
|
||||
"resource://devtools/server/actors/watcher/WatcherRegistry.sys.mjs",
|
||||
// WatcherRegistry needs to be a true singleton and loads ActorManagerParent
|
||||
const { ParentProcessWatcherRegistry } = ChromeUtils.importESModule(
|
||||
"resource://devtools/server/actors/watcher/ParentProcessWatcherRegistry.sys.mjs",
|
||||
// ParentProcessWatcherRegistry needs to be a true singleton and loads ActorManagerParent
|
||||
// which also has to be a true singleton.
|
||||
{ global: "shared" }
|
||||
);
|
||||
|
@ -105,7 +105,7 @@ export class DevToolsProcessParent extends JSProcessActorParent {
|
|||
* Called when the content process notified us about a new target actor
|
||||
*/
|
||||
#onTargetAvailable({ watcherActorID, forwardingPrefix, targetActorForm }) {
|
||||
const watcher = WatcherRegistry.getWatcher(watcherActorID);
|
||||
const watcher = ParentProcessWatcherRegistry.getWatcher(watcherActorID);
|
||||
|
||||
if (!watcher) {
|
||||
throw new Error(
|
||||
|
@ -161,7 +161,7 @@ export class DevToolsProcessParent extends JSProcessActorParent {
|
|||
*/
|
||||
#onTargetDestroyed({ actors, options }) {
|
||||
for (const { watcherActorID, targetActorForm } of actors) {
|
||||
const watcher = WatcherRegistry.getWatcher(watcherActorID);
|
||||
const watcher = ParentProcessWatcherRegistry.getWatcher(watcherActorID);
|
||||
// As we instruct to destroy all targets when the watcher is destroyed,
|
||||
// we may easily receive the target destruction notification *after*
|
||||
// the watcher has been removed from the registry.
|
||||
|
@ -288,7 +288,7 @@ export class DevToolsProcessParent extends JSProcessActorParent {
|
|||
const browsingContext = BrowsingContext.get(
|
||||
message.data.browsingContextId
|
||||
);
|
||||
for (const watcherActor of WatcherRegistry.getWatchersForBrowserId(
|
||||
for (const watcherActor of ParentProcessWatcherRegistry.getWatchersForBrowserId(
|
||||
browsingContext.browserId
|
||||
)) {
|
||||
watcherActor.emit("bf-cache-navigation-pageshow", {
|
||||
|
@ -301,7 +301,7 @@ export class DevToolsProcessParent extends JSProcessActorParent {
|
|||
const browsingContext = BrowsingContext.get(
|
||||
message.data.browsingContextId
|
||||
);
|
||||
for (const watcherActor of WatcherRegistry.getWatchersForBrowserId(
|
||||
for (const watcherActor of ParentProcessWatcherRegistry.getWatchersForBrowserId(
|
||||
browsingContext.browserId
|
||||
)) {
|
||||
watcherActor.emit("bf-cache-navigation-pagehide", {
|
||||
|
|
|
@ -143,7 +143,7 @@ class ContentProcessStartup {
|
|||
|
||||
/**
|
||||
* Called when the content process just started.
|
||||
* This will start creating ContentProcessTarget actors, but only if DevTools code (WatcherActor / WatcherRegistry.sys.mjs)
|
||||
* This will start creating ContentProcessTarget actors, but only if DevTools code (WatcherActor / ParentProcessWatcherRegistry.sys.mjs)
|
||||
* put some data in `sharedData` telling us to do so.
|
||||
*/
|
||||
maybeCreateExistingTargetActors() {
|
||||
|
@ -187,7 +187,7 @@ class ContentProcessStartup {
|
|||
* The prefix of the DevToolsServerConnection of the Watcher Actor.
|
||||
* This is used to compute a unique ID for the target actor.
|
||||
* @param Object sessionData
|
||||
* All data managed by the Watcher Actor and WatcherRegistry.jsm, containing
|
||||
* All data managed by the Watcher Actor and ParentProcessWatcherRegistry.jsm, containing
|
||||
* target types, resources types to be listened as well as breakpoints and any
|
||||
* other data meant to be shared across processes and threads.
|
||||
* @param Object options Dictionary with optional values:
|
||||
|
|
Загрузка…
Ссылка в новой задаче