From 239ef9c9b94ebea143378678ea3d190f0fca851d Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 11 Mar 2010 16:14:50 -0800 Subject: [PATCH 1/2] + Added getMilliseconds() to Utils + Utils.error() now identifies the error as coming from tabcandy + Added a getMilliseconds() to mirror.js (for some reason, it wasn't liking the one in Utils) to replace the use of new Date(), which doesn't work in all situations + Added a heartbeat to TabMirror, where all painting happens now. This allows us to control when and how frequently painting happens, throttling when there are a lot of items on the screen. + Additional clean-up in TabMirror --- browser/base/content/tabview/modules/utils.jsm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/browser/base/content/tabview/modules/utils.jsm b/browser/base/content/tabview/modules/utils.jsm index af0a337b6f4..910eebb9f05 100644 --- a/browser/base/content/tabview/modules/utils.jsm +++ b/browser/base/content/tabview/modules/utils.jsm @@ -88,7 +88,7 @@ var Utils = { error: function(text) { // pass as many arguments as you want, it'll print them all var text = this.expandArgumentsForLog(arguments); - Components.utils.reportError(text); + Components.utils.reportError('tabcandy error: ' + text); }, trace: function(text) { // pass as many arguments as you want, it'll print them all @@ -148,6 +148,12 @@ var Utils = { return (event.button == 2); return false; + }, + + // ___ Time + getMilliseconds: function() { + var date = new Date(); + return date.getTime(); } }; From e291b9c562b016d426047fadcc47c71acb421f36 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 15 Mar 2010 17:15:27 -0700 Subject: [PATCH 2/2] + More major cleanup in mirror.js (especially in the painting code) + New tabs in the stacks candy now find an empty hole rather than piling up at the top + The stacks candy now has a "site" feature (upper right) that groups the tabs by domain + TabMirror now has a feature to allow pausing paint updates. This allows you to fly things around the screen without getting stutter from paint calls. The stacks candy is currently the only candy that takes advantage of this. + The stacks candy was not visually deselecting a group that had been lassoed once the menu went away; it is now. + Added assert() to Utils --- .../base/content/tabview/modules/utils.jsm | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/browser/base/content/tabview/modules/utils.jsm b/browser/base/content/tabview/modules/utils.jsm index 910eebb9f05..15fa671ea23 100644 --- a/browser/base/content/tabview/modules/utils.jsm +++ b/browser/base/content/tabview/modules/utils.jsm @@ -86,12 +86,12 @@ var Utils = { consoleService.logStringMessage(text); }, - error: function(text) { // pass as many arguments as you want, it'll print them all + error: function() { // pass as many arguments as you want, it'll print them all var text = this.expandArgumentsForLog(arguments); - Components.utils.reportError('tabcandy error: ' + text); + Cu.reportError('tabcandy error: ' + text); }, - trace: function(text) { // pass as many arguments as you want, it'll print them all + trace: function() { // pass as many arguments as you want, it'll print them all var text = this.expandArgumentsForLog(arguments); if(typeof(printStackTrace) != 'function') this.log(text + ' trace: you need to include stacktrace.js'); @@ -101,7 +101,19 @@ var Utils = { this.log('trace: ' + text + '\n' + calls.join('\n')); } }, - + + assert: function(label, condition) { + if(!condition) { + var text = 'tabcandy assert: ' + label; + if(typeof(printStackTrace) == 'function') { + var calls = printStackTrace(); + text += '\n' + calls[3]; + } + + Cu.reportError(text); + } + }, + expandObject: function(obj) { var s = obj + ' = {'; for(prop in obj) {