зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1053248
- Add new gesture debug logger. r=yzen
This commit is contained in:
Родитель
095b8e75ff
Коммит
2fd0a320bd
|
@ -228,7 +228,7 @@ this.GestureTracker = { // jshint ignore:line
|
|||
* @param {Number} aTimeStamp A new pointer event timeStamp.
|
||||
*/
|
||||
handle: function GestureTracker_handle(aDetail, aTimeStamp) {
|
||||
Logger.debug(() => {
|
||||
Logger.gesture(() => {
|
||||
return ['Pointer event', aDetail.type, 'at:', aTimeStamp,
|
||||
JSON.stringify(aDetail.points)];
|
||||
});
|
||||
|
@ -332,7 +332,7 @@ function compileDetail(aType, aPoints, keyMap = {x: 'startX', y: 'startY'}) {
|
|||
*/
|
||||
function Gesture(aTimeStamp, aPoints = {}, aLastEvent = undefined) {
|
||||
this.startTime = Date.now();
|
||||
Logger.debug('Creating', this.id, 'gesture.');
|
||||
Logger.gesture('Creating', this.id, 'gesture.');
|
||||
this.points = aPoints;
|
||||
this.lastEvent = aLastEvent;
|
||||
this._deferred = Promise.defer();
|
||||
|
@ -509,7 +509,7 @@ Gesture.prototype = {
|
|||
if (this.isComplete) {
|
||||
return;
|
||||
}
|
||||
Logger.debug('Resolving', this.id, 'gesture.');
|
||||
Logger.gesture('Resolving', this.id, 'gesture.');
|
||||
this.isComplete = true;
|
||||
let detail = this.compile();
|
||||
if (detail) {
|
||||
|
@ -533,7 +533,7 @@ Gesture.prototype = {
|
|||
if (this.isComplete) {
|
||||
return;
|
||||
}
|
||||
Logger.debug('Rejecting', this.id, 'gesture.');
|
||||
Logger.gesture('Rejecting', this.id, 'gesture.');
|
||||
this.isComplete = true;
|
||||
return {
|
||||
id: this.id,
|
||||
|
|
|
@ -473,11 +473,12 @@ State.prototype = {
|
|||
};
|
||||
|
||||
this.Logger = { // jshint ignore:line
|
||||
GESTURE: -1,
|
||||
DEBUG: 0,
|
||||
INFO: 1,
|
||||
WARNING: 2,
|
||||
ERROR: 3,
|
||||
_LEVEL_NAMES: ['DEBUG', 'INFO', 'WARNING', 'ERROR'],
|
||||
_LEVEL_NAMES: ['GESTURE', 'DEBUG', 'INFO', 'WARNING', 'ERROR'],
|
||||
|
||||
logLevel: 1, // INFO;
|
||||
|
||||
|
@ -490,7 +491,7 @@ this.Logger = { // jshint ignore:line
|
|||
|
||||
let args = Array.prototype.slice.call(arguments, 1);
|
||||
let message = (typeof(args[0]) === 'function' ? args[0]() : args).join(' ');
|
||||
message = '[' + Utils.ScriptName + '] ' + this._LEVEL_NAMES[aLogLevel] +
|
||||
message = '[' + Utils.ScriptName + '] ' + this._LEVEL_NAMES[aLogLevel + 1] +
|
||||
' ' + message + '\n';
|
||||
dump(message);
|
||||
// Note: used for testing purposes. If |this.test| is true, also log to
|
||||
|
@ -509,6 +510,11 @@ this.Logger = { // jshint ignore:line
|
|||
this, [this.INFO].concat(Array.prototype.slice.call(arguments)));
|
||||
},
|
||||
|
||||
gesture: function gesture() {
|
||||
this.log.apply(
|
||||
this, [this.GESTURE].concat(Array.prototype.slice.call(arguments)));
|
||||
},
|
||||
|
||||
debug: function debug() {
|
||||
this.log.apply(
|
||||
this, [this.DEBUG].concat(Array.prototype.slice.call(arguments)));
|
||||
|
@ -552,14 +558,16 @@ this.Logger = { // jshint ignore:line
|
|||
},
|
||||
|
||||
accessibleToString: function accessibleToString(aAccessible) {
|
||||
let str = '[ defunct ]';
|
||||
try {
|
||||
str = '[ ' + Utils.AccRetrieval.getStringRole(aAccessible.role) +
|
||||
' | ' + aAccessible.name + ' ]';
|
||||
} catch (x) {
|
||||
if (!aAccessible) {
|
||||
return '[ null ]';
|
||||
}
|
||||
|
||||
return str;
|
||||
try {
|
||||
return'[ ' + Utils.AccRetrieval.getStringRole(aAccessible.role) +
|
||||
' | ' + aAccessible.name + ' ]';
|
||||
} catch (x) {
|
||||
return '[ defunct ]';
|
||||
}
|
||||
},
|
||||
|
||||
eventToString: function eventToString(aEvent) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче