forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1875045 - [devtools] Release Object actors by bulk. r=devtools-re…
…viewers,devtools-backward-compat-reviewers,nchevobbe For now we were releasing object actors one by one. This would force to send an individual RDP request for each of them. The console often release all objects actors related to older console message going over the maximum limit of displayed console messages (10k). This can easily grow in a large number of actors to be released, either if console message are receiving many arguments and/or if many console are logged. We have to have one request per target as the actors could only be reached within same-thread actor. In order to prepare for ObjectFront removal, introduce a target-scoped "Objects" actor which is a singleton per Target. It will receive the new "release in bulk objects actors" method. Later, it will start implementing all the existing methods of the Object Actor in order to migrate away from having to instantiate one Object Front (notice the singular on "Object"), per inspected JS Object. On the fronted side a new Object Command is introduced in order to abstract away the RDP/Fronts work. Differential Revision: https://phabricator.services.mozilla.com/D198784
- Loading branch information
Showing
24 changed files
with
439 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
const { | ||
objectsManagerSpec, | ||
} = require("resource://devtools/shared/specs/objects-manager.js"); | ||
const { | ||
FrontClassWithSpec, | ||
registerFront, | ||
} = require("resource://devtools/shared/protocol.js"); | ||
|
||
class ObjectsManagerFront extends FrontClassWithSpec(objectsManagerSpec) { | ||
constructor(client, targetFront, parentFront) { | ||
super(client, targetFront, parentFront); | ||
|
||
// Attribute name from which to retrieve the actorID out of the target actor's form | ||
this.formAttributeName = "objectsManagerActor"; | ||
} | ||
} | ||
|
||
module.exports = ObjectsManagerFront; | ||
registerFront(ObjectsManagerFront); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
const { Actor } = require("resource://devtools/shared/protocol.js"); | ||
const { | ||
objectsManagerSpec, | ||
} = require("resource://devtools/shared/specs/objects-manager.js"); | ||
|
||
/** | ||
* This actor is a singleton per Target which allows interacting with JS Object | ||
* inspected by DevTools. Typically from the Console or Debugger. | ||
*/ | ||
class ObjectsManagerActor extends Actor { | ||
constructor(conn, targetActor) { | ||
super(conn, objectsManagerSpec); | ||
} | ||
|
||
/** | ||
* Release Actors by bulk by specifying their actor IDs. | ||
* (Passing the whole Front [i.e. Actor's form] would be more expensive than passing only their IDs) | ||
* | ||
* @param {Array<string>} actorIDs | ||
* List of all actor's IDs to release. | ||
*/ | ||
releaseObjects(actorIDs) { | ||
for (const actorID of actorIDs) { | ||
const actor = this.conn.getActor(actorID); | ||
// Note that release will also typically call Actor's destroy and unregister the actor from its Pool | ||
if (actor) { | ||
actor.release(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
exports.ObjectsManagerActor = ObjectsManagerActor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.