Bug 1256397 - Convert ThreadActor into an instance of ActorClass;r=jryans

This commit is contained in:
Eddy Bruel 2016-04-01 10:59:59 +02:00
Родитель c044c81b07
Коммит 9b1d466451
1 изменённых файлов: 46 добавлений и 45 удалений

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

@ -15,6 +15,7 @@ const { FrameActor } = require("devtools/server/actors/frame");
const { ObjectActor, createValueGrip, longStringGrip } = require("devtools/server/actors/object"); const { ObjectActor, createValueGrip, longStringGrip } = require("devtools/server/actors/object");
const { SourceActor, getSourceURL } = require("devtools/server/actors/source"); const { SourceActor, getSourceURL } = require("devtools/server/actors/source");
const { DebuggerServer } = require("devtools/server/main"); const { DebuggerServer } = require("devtools/server/main");
const { ActorClass } = require("devtools/server/protocol");
const DevToolsUtils = require("devtools/shared/DevToolsUtils"); const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { assert, dumpn, update, fetch } = DevToolsUtils; const { assert, dumpn, update, fetch } = DevToolsUtils;
const promise = require("promise"); const promise = require("promise");
@ -22,6 +23,7 @@ const PromiseDebugging = require("PromiseDebugging");
const xpcInspector = require("xpcInspector"); const xpcInspector = require("xpcInspector");
const ScriptStore = require("./utils/ScriptStore"); const ScriptStore = require("./utils/ScriptStore");
const { DevToolsWorker } = require("devtools/shared/worker/worker"); const { DevToolsWorker } = require("devtools/shared/worker/worker");
const object = require("sdk/util/object");
const { defer, resolve, reject, all } = promise; const { defer, resolve, reject, all } = promise;
@ -407,8 +409,10 @@ EventLoop.prototype = {
* An optional (for content debugging only) reference to the content * An optional (for content debugging only) reference to the content
* window. * window.
*/ */
function ThreadActor(aParent, aGlobal) const ThreadActor = ActorClass({
{ typeName: "context",
initialize: function (aParent, aGlobal) {
this._state = "detached"; this._state = "detached";
this._frameActors = []; this._frameActors = [];
this._parent = aParent; this._parent = aParent;
@ -448,14 +452,11 @@ function ThreadActor(aParent, aGlobal)
// Set a wrappedJSObject property so |this| can be sent via the observer svc // Set a wrappedJSObject property so |this| can be sent via the observer svc
// for the xpcshell harness. // for the xpcshell harness.
this.wrappedJSObject = this; this.wrappedJSObject = this;
} },
ThreadActor.prototype = {
// Used by the ObjectActor to keep track of the depth of grip() calls. // Used by the ObjectActor to keep track of the depth of grip() calls.
_gripDepth: null, _gripDepth: null,
actorPrefix: "context",
get dbg() { get dbg() {
if (!this._dbg) { if (!this._dbg) {
this._dbg = this._parent.makeDebugger(); this._dbg = this._parent.makeDebugger();
@ -2032,9 +2033,9 @@ ThreadActor.prototype = {
return { from: this.actorID, return { from: this.actorID,
actors: result }; actors: result };
} }
}; });
ThreadActor.prototype.requestTypes = { ThreadActor.prototype.requestTypes = object.merge(ThreadActor.prototype.requestTypes, {
"attach": ThreadActor.prototype.onAttach, "attach": ThreadActor.prototype.onAttach,
"detach": ThreadActor.prototype.onDetach, "detach": ThreadActor.prototype.onDetach,
"reconfigure": ThreadActor.prototype.onReconfigure, "reconfigure": ThreadActor.prototype.onReconfigure,
@ -2046,8 +2047,8 @@ ThreadActor.prototype.requestTypes = {
"releaseMany": ThreadActor.prototype.onReleaseMany, "releaseMany": ThreadActor.prototype.onReleaseMany,
"sources": ThreadActor.prototype.onSources, "sources": ThreadActor.prototype.onSources,
"threadGrips": ThreadActor.prototype.onThreadGrips, "threadGrips": ThreadActor.prototype.onThreadGrips,
"prototypesAndProperties": ThreadActor.prototype.onPrototypesAndProperties, "prototypesAndProperties": ThreadActor.prototype.onPrototypesAndProperties
}; });
exports.ThreadActor = ThreadActor; exports.ThreadActor = ThreadActor;
@ -2254,7 +2255,7 @@ function hackDebugger(Debugger) {
*/ */
function ChromeDebuggerActor(aConnection, aParent) function ChromeDebuggerActor(aConnection, aParent)
{ {
ThreadActor.call(this, aParent); ThreadActor.prototype.initialize.call(this, aParent);
} }
ChromeDebuggerActor.prototype = Object.create(ThreadActor.prototype); ChromeDebuggerActor.prototype = Object.create(ThreadActor.prototype);
@ -2282,7 +2283,7 @@ exports.ChromeDebuggerActor = ChromeDebuggerActor;
* properties. * properties.
*/ */
function AddonThreadActor(aConnect, aParent) { function AddonThreadActor(aConnect, aParent) {
ThreadActor.call(this, aParent); ThreadActor.prototype.initialize.call(this, aParent);
} }
AddonThreadActor.prototype = Object.create(ThreadActor.prototype); AddonThreadActor.prototype = Object.create(ThreadActor.prototype);