Bug 626017 - Name functions in NetworkPrioritizer.jsm [r=gavin]

This commit is contained in:
Paul O’Shannessy 2011-07-28 13:47:13 -07:00
Родитель d26a74fc10
Коммит fd2581a370
1 изменённых файлов: 13 добавлений и 13 удалений

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

@ -97,13 +97,13 @@ function _handleEvent(aEvent) {
// Methods that impact a browser. Put into single object for organization. // Methods that impact a browser. Put into single object for organization.
let BrowserHelper = { let BrowserHelper = {
onOpen: function(aBrowser) { onOpen: function NP_BH_onOpen(aBrowser) {
// If the tab is in the focused window, leave priority as it is // If the tab is in the focused window, leave priority as it is
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow) if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
this.decreasePriority(aBrowser); this.decreasePriority(aBrowser);
}, },
onSelect: function(aBrowser) { onSelect: function NP_BH_onSelect(aBrowser) {
let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView); let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
if (windowEntry.lastSelectedBrowser) if (windowEntry.lastSelectedBrowser)
this.decreasePriority(windowEntry.lastSelectedBrowser); this.decreasePriority(windowEntry.lastSelectedBrowser);
@ -113,16 +113,16 @@ let BrowserHelper = {
}, },
// Auxiliary methods // Auxiliary methods
getLoadgroup: function(aBrowser) { getLoadgroup: function NP_BH_getLoadgroup(aBrowser) {
return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader) return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority); .loadGroup.QueryInterface(Ci.nsISupportsPriority);
}, },
increasePriority: function(aBrowser) { increasePriority: function NP_BH_increasePriority(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA); this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA);
}, },
decreasePriority: function(aBrowser) { decreasePriority: function NP_BH_decreasePriority(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA * -1); this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA * -1);
} }
}; };
@ -130,7 +130,7 @@ let BrowserHelper = {
// Methods that impact a window. Put into single object for organization. // Methods that impact a window. Put into single object for organization.
let WindowHelper = { let WindowHelper = {
addWindow: function(aWindow) { addWindow: function NP_WH_addWindow(aWindow) {
// Build internal data object // Build internal data object
_windows.push({ window: aWindow, lastSelectedBrowser: null }); _windows.push({ window: aWindow, lastSelectedBrowser: null });
@ -153,7 +153,7 @@ let WindowHelper = {
BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser); BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
}, },
removeWindow: function(aWindow) { removeWindow: function NP_WH_removeWindow(aWindow) {
if (aWindow == _lastFocusedWindow) if (aWindow == _lastFocusedWindow)
_lastFocusedWindow = null; _lastFocusedWindow = null;
@ -169,7 +169,7 @@ let WindowHelper = {
}); });
}, },
onActivate: function(aWindow, aHasFocus) { onActivate: function NP_WH_onActivate(aWindow, aHasFocus) {
// If this window was the last focused window, we don't need to do anything // If this window was the last focused window, we don't need to do anything
if (aWindow == _lastFocusedWindow) if (aWindow == _lastFocusedWindow)
return; return;
@ -181,7 +181,7 @@ let WindowHelper = {
this.increasePriority(aWindow); this.increasePriority(aWindow);
}, },
handleFocusedWindow: function(aWindow) { handleFocusedWindow: function NP_WH_handleFocusedWindow(aWindow) {
// If we have a last focused window, we need to deprioritize it first // If we have a last focused window, we need to deprioritize it first
if (_lastFocusedWindow) if (_lastFocusedWindow)
this.decreasePriority(_lastFocusedWindow); this.decreasePriority(_lastFocusedWindow);
@ -191,23 +191,23 @@ let WindowHelper = {
}, },
// Auxiliary methods // Auxiliary methods
increasePriority: function(aWindow) { increasePriority: function NP_WH_increasePriority(aWindow) {
aWindow.gBrowser.browsers.forEach(function(aBrowser) { aWindow.gBrowser.browsers.forEach(function(aBrowser) {
BrowserHelper.increasePriority(aBrowser); BrowserHelper.increasePriority(aBrowser);
}); });
}, },
decreasePriority: function(aWindow) { decreasePriority: function NP_WH_decreasePriority(aWindow) {
aWindow.gBrowser.browsers.forEach(function(aBrowser) { aWindow.gBrowser.browsers.forEach(function(aBrowser) {
BrowserHelper.decreasePriority(aBrowser); BrowserHelper.decreasePriority(aBrowser);
}); });
}, },
getEntry: function(aWindow) { getEntry: function NP_WH_getEntry(aWindow) {
return _windows[this.getEntryIndex(aWindow)]; return _windows[this.getEntryIndex(aWindow)];
}, },
getEntryIndex: function(aWindow) { getEntryIndex: function NP_WH_getEntryAtIndex(aWindow) {
// Assumes that every object has a unique window & it's in the array // Assumes that every object has a unique window & it's in the array
for (let i = 0; i < _windows.length; i++) for (let i = 0; i < _windows.length; i++)
if (_windows[i].window == aWindow) if (_windows[i].window == aWindow)