зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1277707 - Decouple the fronts from the actors in the shader editor; r=ejpbruel
This commit is contained in:
Родитель
de3a8e2566
Коммит
e3276c78d8
|
@ -67,7 +67,7 @@ loader.lazyRequireGetter(this, "createPerformanceFront",
|
|||
loader.lazyRequireGetter(this, "system",
|
||||
"devtools/shared/system");
|
||||
loader.lazyRequireGetter(this, "getPreferenceFront",
|
||||
"devtools/server/actors/preference", true);
|
||||
"devtools/shared/fronts/preference", true);
|
||||
loader.lazyRequireGetter(this, "KeyShortcuts",
|
||||
"devtools/client/shared/key-shortcuts", true);
|
||||
loader.lazyRequireGetter(this, "ZoomKeys",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
const { Cc, Ci, Cu, Cr } = require("chrome");
|
||||
const promise = require("promise");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
const { WebGLFront } = require("devtools/server/actors/webgl");
|
||||
const { WebGLFront } = require("devtools/shared/fronts/webgl");
|
||||
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
function ShaderEditorPanel(iframeWindow, toolbox) {
|
||||
|
|
|
@ -12,7 +12,7 @@ var promise = require("promise");
|
|||
var { gDevTools } = require("devtools/client/framework/devtools");
|
||||
var { DebuggerClient } = require("devtools/shared/client/main");
|
||||
var { DebuggerServer } = require("devtools/server/main");
|
||||
var { WebGLFront } = require("devtools/server/actors/webgl");
|
||||
var { WebGLFront } = require("devtools/shared/fronts/webgl");
|
||||
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
var { TargetFactory } = require("devtools/client/framework/target");
|
||||
var { Toolbox } = require("devtools/client/framework/toolbox");
|
||||
|
|
|
@ -16,8 +16,8 @@ const {AppValidator} = require("devtools/client/webide/modules/app-validator");
|
|||
const {ConnectionManager, Connection} = require("devtools/shared/client/connection-manager");
|
||||
const {AppActorFront} = require("devtools/shared/apps/app-actor-front");
|
||||
const {getDeviceFront} = require("devtools/server/actors/device");
|
||||
const {getPreferenceFront} = require("devtools/server/actors/preference");
|
||||
const {getSettingsFront} = require("devtools/server/actors/settings");
|
||||
const {getPreferenceFront} = require("devtools/shared/fronts/preference");
|
||||
const {getSettingsFront} = require("devtools/shared/fronts/settings");
|
||||
const {Task} = require("devtools/shared/task");
|
||||
const {RuntimeScanners, RuntimeTypes} = require("devtools/client/webide/modules/runtimes");
|
||||
const {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
|
|
|
@ -6,6 +6,7 @@ const {Cc, Ci, Cu, CC} = require("chrome");
|
|||
const protocol = require("devtools/shared/protocol");
|
||||
const {Arg, method, RetVal} = protocol;
|
||||
const Services = require("Services");
|
||||
const {preferenceSpec} = require("devtools/shared/specs/preference");
|
||||
|
||||
exports.register = function (handle) {
|
||||
handle.addGlobalActor(PreferenceActor, "preferenceActor");
|
||||
|
@ -14,31 +15,22 @@ exports.register = function (handle) {
|
|||
exports.unregister = function (handle) {
|
||||
};
|
||||
|
||||
var PreferenceActor = exports.PreferenceActor = protocol.ActorClass({
|
||||
var PreferenceActor = exports.PreferenceActor = protocol.ActorClassWithSpec(preferenceSpec, {
|
||||
typeName: "preference",
|
||||
|
||||
getBoolPref: method(function (name) {
|
||||
getBoolPref: function (name) {
|
||||
return Services.prefs.getBoolPref(name);
|
||||
}, {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("boolean") }
|
||||
}),
|
||||
},
|
||||
|
||||
getCharPref: method(function (name) {
|
||||
getCharPref: function (name) {
|
||||
return Services.prefs.getCharPref(name);
|
||||
}, {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("string") }
|
||||
}),
|
||||
},
|
||||
|
||||
getIntPref: method(function (name) {
|
||||
getIntPref: function (name) {
|
||||
return Services.prefs.getIntPref(name);
|
||||
}, {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("number") }
|
||||
}),
|
||||
},
|
||||
|
||||
getAllPrefs: method(function () {
|
||||
getAllPrefs: function () {
|
||||
let prefs = {};
|
||||
Services.prefs.getChildList("").forEach(function (name, index) {
|
||||
// append all key/value pairs into a huge json object.
|
||||
|
@ -65,64 +57,25 @@ var PreferenceActor = exports.PreferenceActor = protocol.ActorClass({
|
|||
}
|
||||
});
|
||||
return prefs;
|
||||
}, {
|
||||
request: {},
|
||||
response: { value: RetVal("json") }
|
||||
}),
|
||||
},
|
||||
|
||||
setBoolPref: method(function (name, value) {
|
||||
setBoolPref: function (name, value) {
|
||||
Services.prefs.setBoolPref(name, value);
|
||||
Services.prefs.savePrefFile(null);
|
||||
}, {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
}),
|
||||
},
|
||||
|
||||
setCharPref: method(function (name, value) {
|
||||
setCharPref: function (name, value) {
|
||||
Services.prefs.setCharPref(name, value);
|
||||
Services.prefs.savePrefFile(null);
|
||||
}, {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
}),
|
||||
},
|
||||
|
||||
setIntPref: method(function (name, value) {
|
||||
setIntPref: function (name, value) {
|
||||
Services.prefs.setIntPref(name, value);
|
||||
Services.prefs.savePrefFile(null);
|
||||
}, {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
}),
|
||||
},
|
||||
|
||||
clearUserPref: method(function (name) {
|
||||
clearUserPref: function (name) {
|
||||
Services.prefs.clearUserPref(name);
|
||||
Services.prefs.savePrefFile(null);
|
||||
}, {
|
||||
request: { name: Arg(0) },
|
||||
response: {}
|
||||
}),
|
||||
});
|
||||
|
||||
var PreferenceFront = protocol.FrontClass(PreferenceActor, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client);
|
||||
this.actorID = form.preferenceActor;
|
||||
this.manage(this);
|
||||
},
|
||||
});
|
||||
|
||||
const _knownPreferenceFronts = new WeakMap();
|
||||
|
||||
exports.getPreferenceFront = function (client, form) {
|
||||
if (!form.preferenceActor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_knownPreferenceFronts.has(client)) {
|
||||
return _knownPreferenceFronts.get(client);
|
||||
}
|
||||
|
||||
let front = new PreferenceFront(client, form);
|
||||
_knownPreferenceFronts.set(client, front);
|
||||
return front;
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@ const {Arg, method, RetVal} = protocol;
|
|||
const {DebuggerServer} = require("devtools/server/main");
|
||||
const promise = require("promise");
|
||||
const Services = require("Services");
|
||||
const { settingsSpec } = require("devtools/shared/specs/settings");
|
||||
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
@ -63,15 +64,13 @@ function loadSettingsFile() {
|
|||
}
|
||||
}
|
||||
|
||||
var SettingsActor = exports.SettingsActor = protocol.ActorClass({
|
||||
typeName: "settings",
|
||||
|
||||
var SettingsActor = exports.SettingsActor = protocol.ActorClassWithSpec(settingsSpec, {
|
||||
_getSettingsService: function () {
|
||||
let win = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
|
||||
return win.navigator.mozSettings;
|
||||
},
|
||||
|
||||
getSetting: method(function (name) {
|
||||
getSetting: function (name) {
|
||||
let deferred = promise.defer();
|
||||
let lock = this._getSettingsService().createLock();
|
||||
let req = lock.get(name);
|
||||
|
@ -82,12 +81,9 @@ var SettingsActor = exports.SettingsActor = protocol.ActorClass({
|
|||
deferred.reject(req.error);
|
||||
};
|
||||
return deferred.promise;
|
||||
}, {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("json") }
|
||||
}),
|
||||
},
|
||||
|
||||
setSetting: method(function (name, value) {
|
||||
setSetting: function (name, value) {
|
||||
let deferred = promise.defer();
|
||||
let data = {};
|
||||
data[name] = value;
|
||||
|
@ -100,10 +96,7 @@ var SettingsActor = exports.SettingsActor = protocol.ActorClass({
|
|||
deferred.reject(req.error);
|
||||
};
|
||||
return deferred.promise;
|
||||
}, {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
}),
|
||||
},
|
||||
|
||||
_hasUserSetting: function (name, value) {
|
||||
if (typeof value === "object") {
|
||||
|
@ -112,7 +105,7 @@ var SettingsActor = exports.SettingsActor = protocol.ActorClass({
|
|||
return (defaultSettings[name] !== value);
|
||||
},
|
||||
|
||||
getAllSettings: method(function () {
|
||||
getAllSettings: function () {
|
||||
loadSettingsFile();
|
||||
let settings = {};
|
||||
let self = this;
|
||||
|
@ -135,45 +128,17 @@ var SettingsActor = exports.SettingsActor = protocol.ActorClass({
|
|||
};
|
||||
|
||||
return deferred.promise;
|
||||
}, {
|
||||
request: {},
|
||||
response: { value: RetVal("json") }
|
||||
}),
|
||||
},
|
||||
|
||||
clearUserSetting: method(function (name) {
|
||||
clearUserSetting: function (name) {
|
||||
loadSettingsFile();
|
||||
try {
|
||||
this.setSetting(name, defaultSettings[name]);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}, {
|
||||
request: { name: Arg(0) },
|
||||
response: {}
|
||||
})
|
||||
});
|
||||
|
||||
var SettingsFront = protocol.FrontClass(SettingsActor, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client);
|
||||
this.actorID = form.settingsActor;
|
||||
this.manage(this);
|
||||
},
|
||||
});
|
||||
|
||||
const _knownSettingsFronts = new WeakMap();
|
||||
|
||||
exports.getSettingsFront = function (client, form) {
|
||||
if (!form.settingsActor) {
|
||||
return null;
|
||||
}
|
||||
if (_knownSettingsFronts.has(client)) {
|
||||
return _knownSettingsFronts.get(client);
|
||||
}
|
||||
let front = new SettingsFront(client, form);
|
||||
_knownSettingsFronts.set(client, front);
|
||||
return front;
|
||||
};
|
||||
});
|
||||
|
||||
// For tests
|
||||
exports._setDefaultSettings = function (settings) {
|
||||
|
|
|
@ -10,6 +10,11 @@ const protocol = require("devtools/shared/protocol");
|
|||
const { ContentObserver } = require("devtools/shared/content-observer");
|
||||
const { on, once, off, emit } = events;
|
||||
const { method, Arg, Option, RetVal } = protocol;
|
||||
const {
|
||||
shaderSpec,
|
||||
programSpec,
|
||||
webGLSpec,
|
||||
} = require("devtools/shared/specs/webgl");
|
||||
|
||||
const WEBGL_CONTEXT_NAMES = ["webgl", "experimental-webgl", "moz-webgl"];
|
||||
|
||||
|
@ -23,9 +28,7 @@ const PROGRAM_HIGHLIGHT_TRAIT = 2;
|
|||
* You can either retrieve, or compile the source of a shader, which will
|
||||
* automatically inflict the necessary changes to the WebGL state.
|
||||
*/
|
||||
var ShaderActor = protocol.ActorClass({
|
||||
typeName: "gl-shader",
|
||||
|
||||
var ShaderActor = protocol.ActorClassWithSpec(shaderSpec, {
|
||||
/**
|
||||
* Create the shader actor.
|
||||
*
|
||||
|
@ -49,16 +52,14 @@ var ShaderActor = protocol.ActorClass({
|
|||
/**
|
||||
* Gets the source code for this shader.
|
||||
*/
|
||||
getText: method(function () {
|
||||
getText: function () {
|
||||
return this.text;
|
||||
}, {
|
||||
response: { text: RetVal("string") }
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets and compiles new source code for this shader.
|
||||
*/
|
||||
compile: method(function (text) {
|
||||
compile: function (text) {
|
||||
// Get the shader and corresponding program to change via the WebGL proxy.
|
||||
let { linkedProxy: proxy, shader, program } = this;
|
||||
|
||||
|
@ -75,18 +76,6 @@ var ShaderActor = protocol.ActorClass({
|
|||
return error;
|
||||
}
|
||||
return undefined;
|
||||
}, {
|
||||
request: { text: Arg(0, "string") },
|
||||
response: { error: RetVal("nullable:json") }
|
||||
})
|
||||
});
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the ShaderActor.
|
||||
*/
|
||||
var ShaderFront = protocol.FrontClass(ShaderActor, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client, form);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -94,9 +83,7 @@ var ShaderFront = protocol.FrontClass(ShaderActor, {
|
|||
* A WebGL program is composed (at the moment, analogue to OpenGL ES 2.0)
|
||||
* of two shaders: a vertex shader and a fragment shader.
|
||||
*/
|
||||
var ProgramActor = protocol.ActorClass({
|
||||
typeName: "gl-program",
|
||||
|
||||
var ProgramActor = protocol.ActorClassWithSpec(programSpec, {
|
||||
/**
|
||||
* Create the program actor.
|
||||
*
|
||||
|
@ -132,59 +119,46 @@ var ProgramActor = protocol.ActorClass({
|
|||
* Gets the vertex shader linked to this program. This method guarantees
|
||||
* a single actor instance per shader.
|
||||
*/
|
||||
getVertexShader: method(function () {
|
||||
getVertexShader: function () {
|
||||
return this._getShaderActor("vertex");
|
||||
}, {
|
||||
response: { shader: RetVal("gl-shader") }
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the fragment shader linked to this program. This method guarantees
|
||||
* a single actor instance per shader.
|
||||
*/
|
||||
getFragmentShader: method(function () {
|
||||
getFragmentShader: function () {
|
||||
return this._getShaderActor("fragment");
|
||||
}, {
|
||||
response: { shader: RetVal("gl-shader") }
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlights any geometry rendered using this program.
|
||||
*/
|
||||
highlight: method(function (tint) {
|
||||
highlight: function (tint) {
|
||||
this.linkedProxy.highlightTint = tint;
|
||||
this.linkedCache.setProgramTrait(this.program, PROGRAM_HIGHLIGHT_TRAIT);
|
||||
}, {
|
||||
request: { tint: Arg(0, "array:number") },
|
||||
oneway: true
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Allows geometry to be rendered normally using this program.
|
||||
*/
|
||||
unhighlight: method(function () {
|
||||
unhighlight: function () {
|
||||
this.linkedCache.unsetProgramTrait(this.program, PROGRAM_HIGHLIGHT_TRAIT);
|
||||
}, {
|
||||
oneway: true
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Prevents any geometry from being rendered using this program.
|
||||
*/
|
||||
blackbox: method(function () {
|
||||
blackbox: function () {
|
||||
this.linkedCache.setProgramTrait(this.program, PROGRAM_BLACKBOX_TRAIT);
|
||||
}, {
|
||||
oneway: true
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Allows geometry to be rendered using this program.
|
||||
*/
|
||||
unblackbox: method(function () {
|
||||
unblackbox: function () {
|
||||
this.linkedCache.unsetProgramTrait(this.program, PROGRAM_BLACKBOX_TRAIT);
|
||||
}, {
|
||||
oneway: true
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a cached ShaderActor instance based on the required shader type.
|
||||
|
@ -205,22 +179,12 @@ var ProgramActor = protocol.ActorClass({
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the ProgramActor.
|
||||
*/
|
||||
var ProgramFront = protocol.FrontClass(ProgramActor, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client, form);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The WebGL Actor handles simple interaction with a WebGL context via a few
|
||||
* high-level methods. After instantiating this actor, you'll need to set it
|
||||
* up by calling setup().
|
||||
*/
|
||||
var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
||||
typeName: "webgl",
|
||||
var WebGLActor = exports.WebGLActor = protocol.ActorClassWithSpec(webGLSpec, {
|
||||
initialize: function (conn, tabActor) {
|
||||
protocol.Actor.prototype.initialize.call(this, conn);
|
||||
this.tabActor = tabActor;
|
||||
|
@ -240,7 +204,7 @@ var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
|||
*
|
||||
* See ContentObserver and WebGLInstrumenter for more details.
|
||||
*/
|
||||
setup: method(function ({ reload }) {
|
||||
setup: function ({ reload }) {
|
||||
if (this._initialized) {
|
||||
return;
|
||||
}
|
||||
|
@ -256,17 +220,14 @@ var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
|||
if (reload) {
|
||||
this.tabActor.window.location.reload();
|
||||
}
|
||||
}, {
|
||||
request: { reload: Option(0, "boolean") },
|
||||
oneway: true
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops listening for document global changes and puts this actor
|
||||
* to hibernation. This method is called automatically just before the
|
||||
* actor is destroyed.
|
||||
*/
|
||||
finalize: method(function () {
|
||||
finalize: function () {
|
||||
if (!this._initialized) {
|
||||
return;
|
||||
}
|
||||
|
@ -279,32 +240,26 @@ var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
|||
this._programActorsCache = null;
|
||||
this._contentObserver = null;
|
||||
this._webglObserver = null;
|
||||
}, {
|
||||
oneway: true
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets an array of cached program actors for the current tab actor's window.
|
||||
* This is useful for dealing with bfcache, when no new programs are linked.
|
||||
*/
|
||||
getPrograms: method(function () {
|
||||
getPrograms: function () {
|
||||
let id = ContentObserver.GetInnerWindowID(this.tabActor.window);
|
||||
return this._programActorsCache.filter(e => e.ownerWindow == id);
|
||||
}, {
|
||||
response: { programs: RetVal("array:gl-program") }
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Waits for one frame via `requestAnimationFrame` on the tab actor's window.
|
||||
* Used in tests.
|
||||
*/
|
||||
waitForFrame: method(function () {
|
||||
waitForFrame: function () {
|
||||
let deferred = promise.defer();
|
||||
this.tabActor.window.requestAnimationFrame(deferred.resolve);
|
||||
return deferred.promise;
|
||||
}, {
|
||||
response: { success: RetVal("nullable:json") }
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets a pixel's RGBA value from a context specified by selector
|
||||
|
@ -318,7 +273,7 @@ var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
|||
* @return Object
|
||||
* An object containing `r`, `g`, `b`, and `a` properties of the pixel.
|
||||
*/
|
||||
getPixel: method(function ({ selector, position }) {
|
||||
getPixel: function ({ selector, position }) {
|
||||
let { x, y } = position;
|
||||
let canvas = this.tabActor.window.document.querySelector(selector);
|
||||
let context = XPCNativeWrapper.unwrap(canvas.getContext("webgl"));
|
||||
|
@ -331,42 +286,15 @@ var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
|||
proxy.readPixels(x, height - y - 1, 1, 1, context.RGBA, context.UNSIGNED_BYTE, buffer);
|
||||
|
||||
return { r: buffer[0], g: buffer[1], b: buffer[2], a: buffer[3] };
|
||||
}, {
|
||||
request: {
|
||||
selector: Option(0, "string"),
|
||||
position: Option(0, "json")
|
||||
},
|
||||
response: { pixels: RetVal("json") }
|
||||
}),
|
||||
|
||||
/**
|
||||
* Events emitted by this actor. The "program-linked" event is fired
|
||||
* every time a WebGL program was linked with its respective two shaders.
|
||||
*/
|
||||
events: {
|
||||
"program-linked": {
|
||||
type: "programLinked",
|
||||
program: Arg(0, "gl-program")
|
||||
},
|
||||
"global-destroyed": {
|
||||
type: "globalDestroyed",
|
||||
program: Arg(0, "number")
|
||||
},
|
||||
"global-created": {
|
||||
type: "globalCreated",
|
||||
program: Arg(0, "number")
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets an array of all cached program actors belonging to all windows.
|
||||
* This should only be used for tests.
|
||||
*/
|
||||
_getAllPrograms: method(function () {
|
||||
_getAllPrograms: function () {
|
||||
return this._programActorsCache;
|
||||
}, {
|
||||
response: { programs: RetVal("array:gl-program") }
|
||||
}),
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
|
@ -400,16 +328,6 @@ var WebGLActor = exports.WebGLActor = protocol.ActorClass({
|
|||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the WebGLActor.
|
||||
*/
|
||||
var WebGLFront = exports.WebGLFront = protocol.FrontClass(WebGLActor, {
|
||||
initialize: function (client, { webglActor }) {
|
||||
protocol.Front.prototype.initialize.call(this, client, { actor: webglActor });
|
||||
this.manage(this);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Instruments a HTMLCanvasElement with the appropriate inspection methods.
|
||||
*/
|
||||
|
|
|
@ -25,7 +25,7 @@ function runTests() {
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {getPreferenceFront} = require("devtools/server/actors/preference");
|
||||
var {getPreferenceFront} = require("devtools/shared/fronts/preference");
|
||||
|
||||
DebuggerServer.init();
|
||||
DebuggerServer.addBrowserActors();
|
||||
|
|
|
@ -29,7 +29,8 @@ function runTests() {
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var {getSettingsFront, _setDefaultSettings} = require("devtools/server/actors/settings");
|
||||
var {getSettingsFront} = require("devtools/shared/fronts/settings");
|
||||
var {_setDefaultSettings} = require("devtools/server/actors/settings");
|
||||
|
||||
DebuggerServer.init(function () { return true; });
|
||||
DebuggerServer.addBrowserActors();
|
||||
|
|
|
@ -13,8 +13,11 @@ DevToolsModules(
|
|||
'css-properties.js',
|
||||
'highlighters.js',
|
||||
'inspector.js',
|
||||
'preference.js',
|
||||
'settings.js',
|
||||
'storage.js',
|
||||
'styles.js',
|
||||
'stylesheets.js',
|
||||
'webaudio.js'
|
||||
'webaudio.js',
|
||||
'webgl.js'
|
||||
)
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
/* 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 {preferenceSpec} = require("devtools/shared/specs/preference");
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
|
||||
const PreferenceFront = protocol.FrontClassWithSpec(preferenceSpec, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client);
|
||||
this.actorID = form.preferenceActor;
|
||||
this.manage(this);
|
||||
},
|
||||
});
|
||||
|
||||
const _knownPreferenceFronts = new WeakMap();
|
||||
|
||||
exports.getPreferenceFront = function (client, form) {
|
||||
if (!form.preferenceActor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_knownPreferenceFronts.has(client)) {
|
||||
return _knownPreferenceFronts.get(client);
|
||||
}
|
||||
|
||||
let front = new PreferenceFront(client, form);
|
||||
_knownPreferenceFronts.set(client, front);
|
||||
return front;
|
||||
};
|
|
@ -0,0 +1,29 @@
|
|||
/* 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 {settingsSpec} = require("devtools/shared/specs/settings");
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
|
||||
const SettingsFront = protocol.FrontClassWithSpec(settingsSpec, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client);
|
||||
this.actorID = form.settingsActor;
|
||||
this.manage(this);
|
||||
},
|
||||
});
|
||||
|
||||
const _knownSettingsFronts = new WeakMap();
|
||||
|
||||
exports.getSettingsFront = function (client, form) {
|
||||
if (!form.settingsActor) {
|
||||
return null;
|
||||
}
|
||||
if (_knownSettingsFronts.has(client)) {
|
||||
return _knownSettingsFronts.get(client);
|
||||
}
|
||||
let front = new SettingsFront(client, form);
|
||||
_knownSettingsFronts.set(client, front);
|
||||
return front;
|
||||
};
|
|
@ -0,0 +1,45 @@
|
|||
/* 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 {
|
||||
shaderSpec,
|
||||
programSpec,
|
||||
webGLSpec,
|
||||
} = require("devtools/shared/specs/webgl");
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the ShaderActor.
|
||||
*/
|
||||
const ShaderFront = protocol.FrontClassWithSpec(shaderSpec, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client, form);
|
||||
}
|
||||
});
|
||||
|
||||
exports.ShaderFront = ShaderFront;
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the ProgramActor.
|
||||
*/
|
||||
const ProgramFront = protocol.FrontClassWithSpec(programSpec, {
|
||||
initialize: function (client, form) {
|
||||
protocol.Front.prototype.initialize.call(this, client, form);
|
||||
}
|
||||
});
|
||||
|
||||
exports.ProgramFront = ProgramFront;
|
||||
|
||||
/**
|
||||
* The corresponding Front object for the WebGLActor.
|
||||
*/
|
||||
const WebGLFront = protocol.FrontClassWithSpec(webGLSpec, {
|
||||
initialize: function (client, { webglActor }) {
|
||||
protocol.Front.prototype.initialize.call(this, client, { actor: webglActor });
|
||||
this.manage(this);
|
||||
}
|
||||
});
|
||||
|
||||
exports.WebGLFront = WebGLFront;
|
|
@ -14,10 +14,19 @@ DevToolsModules(
|
|||
'heap-snapshot-file.js',
|
||||
'highlighters.js',
|
||||
'inspector.js',
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
'node.js',
|
||||
=======
|
||||
=======
|
||||
'preference.js',
|
||||
>>>>>>> 2b386d5... Bug 1277717 - Decouple the PreferenceFront from the PreferenceActor; r=ejpbruel
|
||||
'settings.js',
|
||||
>>>>>>> e4a75c4... Bug 1277715 - Decouple the SettingsFront from the SettingsActor; r=ejpbruel
|
||||
'storage.js',
|
||||
'styleeditor.js',
|
||||
'styles.js',
|
||||
'stylesheets.js',
|
||||
'webaudio.js'
|
||||
'webaudio.js',
|
||||
'webgl.js'
|
||||
)
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* 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 {Arg, RetVal, generateActorSpec} = require("devtools/shared/protocol");
|
||||
|
||||
const preferenceSpec = generateActorSpec({
|
||||
typeName: "preference",
|
||||
|
||||
methods: {
|
||||
getBoolPref: {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("boolean") }
|
||||
},
|
||||
getCharPref: {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("string") }
|
||||
},
|
||||
getIntPref: {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("number") }
|
||||
},
|
||||
getAllPrefs: {
|
||||
request: {},
|
||||
response: { value: RetVal("json") }
|
||||
},
|
||||
setBoolPref: {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
},
|
||||
setCharPref: {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
},
|
||||
setIntPref: {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
},
|
||||
clearUserPref: {
|
||||
request: { name: Arg(0) },
|
||||
response: {}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
exports.preferenceSpec = preferenceSpec;
|
|
@ -0,0 +1,31 @@
|
|||
/* 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 {Arg, RetVal, generateActorSpec} = require("devtools/shared/protocol");
|
||||
|
||||
const settingsSpec = generateActorSpec({
|
||||
typeName: "settings",
|
||||
|
||||
methods: {
|
||||
getSetting: {
|
||||
request: { value: Arg(0) },
|
||||
response: { value: RetVal("json") }
|
||||
},
|
||||
setSetting: {
|
||||
request: { name: Arg(0), value: Arg(1) },
|
||||
response: {}
|
||||
},
|
||||
getAllSettings: {
|
||||
request: {},
|
||||
response: { value: RetVal("json") }
|
||||
},
|
||||
clearUserSetting: {
|
||||
request: { name: Arg(0) },
|
||||
response: {}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
exports.settingsSpec = settingsSpec;
|
|
@ -0,0 +1,101 @@
|
|||
/* 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 {Arg, Option, RetVal, generateActorSpec} = require("devtools/shared/protocol");
|
||||
|
||||
const shaderSpec = generateActorSpec({
|
||||
typeName: "gl-shader",
|
||||
|
||||
methods: {
|
||||
getText: {
|
||||
response: { text: RetVal("string") }
|
||||
},
|
||||
compile: {
|
||||
request: { text: Arg(0, "string") },
|
||||
response: { error: RetVal("nullable:json") }
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
exports.shaderSpec = shaderSpec;
|
||||
|
||||
const programSpec = generateActorSpec({
|
||||
typeName: "gl-program",
|
||||
|
||||
methods: {
|
||||
getVertexShader: {
|
||||
response: { shader: RetVal("gl-shader") }
|
||||
},
|
||||
getFragmentShader: {
|
||||
response: { shader: RetVal("gl-shader") }
|
||||
},
|
||||
highlight: {
|
||||
request: { tint: Arg(0, "array:number") },
|
||||
oneway: true
|
||||
},
|
||||
unhighlight: {
|
||||
oneway: true
|
||||
},
|
||||
blackbox: {
|
||||
oneway: true
|
||||
},
|
||||
unblackbox: {
|
||||
oneway: true
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
exports.programSpec = programSpec;
|
||||
|
||||
const webGLSpec = generateActorSpec({
|
||||
typeName: "webgl",
|
||||
|
||||
/**
|
||||
* Events emitted by this actor. The "program-linked" event is fired every
|
||||
* time a WebGL program was linked with its respective two shaders.
|
||||
*/
|
||||
events: {
|
||||
"program-linked": {
|
||||
type: "programLinked",
|
||||
program: Arg(0, "gl-program")
|
||||
},
|
||||
"global-destroyed": {
|
||||
type: "globalDestroyed",
|
||||
program: Arg(0, "number")
|
||||
},
|
||||
"global-created": {
|
||||
type: "globalCreated",
|
||||
program: Arg(0, "number")
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
setup: {
|
||||
request: { reload: Option(0, "boolean") },
|
||||
oneway: true
|
||||
},
|
||||
finalize: {
|
||||
oneway: true
|
||||
},
|
||||
getPrograms: {
|
||||
response: { programs: RetVal("array:gl-program") }
|
||||
},
|
||||
waitForFrame: {
|
||||
response: { success: RetVal("nullable:json") }
|
||||
},
|
||||
getPixel: {
|
||||
request: {
|
||||
selector: Option(0, "string"),
|
||||
position: Option(0, "json")
|
||||
},
|
||||
response: { pixels: RetVal("json") }
|
||||
},
|
||||
_getAllPrograms: {
|
||||
response: { programs: RetVal("array:gl-program") }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.webGLSpec = webGLSpec;
|
Загрузка…
Ссылка в новой задаче