add module for performance tuning
This commit is contained in:
parent
ff1fef531f
commit
60f3b28c54
@ -38,6 +38,9 @@ const EXPORTED_SYMBOLS = ['TreeStyleTabBrowser'];
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
// Components.utils.import('resource://treestyletab-modules/rap.js');
|
||||
// rap();
|
||||
|
||||
Components.utils.import('resource://treestyletab-modules/window.js');
|
||||
|
||||
function TreeStyleTabBrowser(aWindowService, aTabBrowser)
|
||||
@ -526,6 +529,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
init : function TSTBrowser_init()
|
||||
{
|
||||
// rap('browser/init start');
|
||||
this.stopRendering();
|
||||
|
||||
var w = this.window;
|
||||
@ -605,6 +609,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
this.fireTabbarPositionEvent(false, 'top', position); /* PUBLIC API */
|
||||
|
||||
this.startRendering();
|
||||
// rap('browser/init end');
|
||||
},
|
||||
|
||||
_initTabbrowserExtraContents : function TSTBrowser_initTabbrowserExtraContents()
|
||||
@ -5248,4 +5253,5 @@ TreeStyleTabBrowser.prototype = {
|
||||
cancelHideTabbarForFeedback : function TSTBrowser_cancelHideTabbarForFeedback() { this.autoHide.cancelHideForFeedback(); }
|
||||
|
||||
};
|
||||
// rap('end of definition of browser');
|
||||
|
||||
|
11
modules/rap.js
Normal file
11
modules/rap.js
Normal file
@ -0,0 +1,11 @@
|
||||
const EXPORTED_SYMBOLS = ['rap'];
|
||||
|
||||
var last = -1;
|
||||
var start = Date.now();
|
||||
|
||||
function rap(aMessage) {
|
||||
var now = Date.now();
|
||||
var time = last < 0 ? 0 : (now - last);
|
||||
dump(time+' (total '+(now - start)+') : '+(aMessage || Components.stack.caller)+'\n');
|
||||
last = now;
|
||||
}
|
@ -40,6 +40,8 @@ const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
// Components.utils.import('resource://treestyletab-modules/rap.js');
|
||||
// rap();
|
||||
Components.utils.import('resource://treestyletab-modules/lib/prefs.js');
|
||||
Components.utils.import('resource://treestyletab-modules/lib/namespace.jsm');
|
||||
var window = getNamespaceFor('piro.sakura.ne.jp');
|
||||
@ -79,6 +81,7 @@ XPCOMUtils.defineLazyGetter(this, 'confirmWithTab', function() {
|
||||
Components.utils.import('resource://treestyletab-modules/lib/confirmWithTab.js', ns);
|
||||
return ns.confirmWithTab;
|
||||
});
|
||||
// rap('end of definition of lazy getters');
|
||||
|
||||
var TreeStyleTabUtils = {
|
||||
__proto__ : window['piro.sakura.ne.jp'].prefs,
|
||||
@ -332,6 +335,7 @@ var TreeStyleTabUtils = {
|
||||
|
||||
init : function TSTUtils_init()
|
||||
{
|
||||
// rap('utils/init start');
|
||||
if (this._initialized) return;
|
||||
|
||||
this.isMac = this.XULAppInfo.OS == 'Darwin';
|
||||
@ -361,6 +365,7 @@ var TreeStyleTabUtils = {
|
||||
catch(e) {
|
||||
dump(e+'\n');
|
||||
}
|
||||
// rap('utils/init end');
|
||||
},
|
||||
_initialized : false,
|
||||
applyPlatformDefaultPrefs : function TSTUtils_applyPlatformDefaultPrefs()
|
||||
@ -2429,5 +2434,7 @@ var TreeStyleTabUtils = {
|
||||
|
||||
};
|
||||
|
||||
// rap('end of definition of utils');
|
||||
TreeStyleTabUtils.init();
|
||||
// rap('end of initialization of utils');
|
||||
|
||||
|
@ -40,6 +40,8 @@ const Ci = Components.interfaces;
|
||||
|
||||
Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
// Components.utils.import('resource://treestyletab-modules/rap.js');
|
||||
// rap();
|
||||
Components.utils.import('resource://treestyletab-modules/utils.js');
|
||||
XPCOMUtils.defineLazyGetter(this, 'TreeStyleTabBrowser', function() {
|
||||
var ns = {};
|
||||
@ -282,6 +284,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
preInit : function TSTWindow_preInit()
|
||||
{
|
||||
// rap('window/preInit start');
|
||||
if (this.preInitialized) return;
|
||||
this.preInitialized = true;
|
||||
|
||||
@ -298,6 +301,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
// initialize theme
|
||||
this.onPrefChange('extensions.treestyletab.tabbar.style');
|
||||
// rap('window/preInit end');
|
||||
},
|
||||
preInitialized : false,
|
||||
|
||||
@ -407,6 +411,7 @@ TreeStyleTabWindow.prototype = {
|
||||
|
||||
init : function TSTWindow_init()
|
||||
{
|
||||
// rap('window/init start');
|
||||
var w = this.window;
|
||||
w.removeEventListener('load', this, false);
|
||||
w.addEventListener('unload', this, false);
|
||||
@ -455,6 +460,7 @@ TreeStyleTabWindow.prototype = {
|
||||
if (this.isAutoHide)
|
||||
this.onPrefChange('extensions.treestyletab.tabbar.autoHide.mode');
|
||||
this.onPrefChange('extensions.treestyletab.autoCollapseExpandSubtreeOnSelect.whileFocusMovingByShortcut');
|
||||
// rap('window/init end');
|
||||
},
|
||||
initialized : false,
|
||||
|
||||
@ -1606,4 +1612,5 @@ TreeStyleTabWindow.prototype = {
|
||||
}
|
||||
|
||||
};
|
||||
// rap('end of definition of window');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user