Bug 626017 - Name functions in NetworkPrioritizer.jsm [r=gavin]
authorPaul O’Shannessy <paul@oshannessy.com>
Thu, 28 Jul 2011 13:47:13 -0700
changeset 73547 c43da82198f150c13fffd2629b98cf005d7826d0
parent 73546 109894baf0c73c3ed0caf8d56b68354c879106db
child 73548 7dfbf51f63c5091aa6753833148e2277dcce3a61
push idunknown
push userunknown
push dateunknown
reviewersgavin
bugs626017
milestone8.0a1
Bug 626017 - Name functions in NetworkPrioritizer.jsm [r=gavin]
browser/base/content/NetworkPrioritizer.jsm
--- a/browser/base/content/NetworkPrioritizer.jsm
+++ b/browser/base/content/NetworkPrioritizer.jsm
@@ -92,50 +92,50 @@ function _handleEvent(aEvent) {
       WindowHelper.removeWindow(aEvent.currentTarget);
       break;
   }
 }
 
 
 // Methods that impact a browser. Put into single object for organization.
 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 (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
       this.decreasePriority(aBrowser);
   },
 
-  onSelect: function(aBrowser) {
+  onSelect: function NP_BH_onSelect(aBrowser) {
     let windowEntry = WindowHelper.getEntry(aBrowser.ownerDocument.defaultView);
     if (windowEntry.lastSelectedBrowser)
       this.decreasePriority(windowEntry.lastSelectedBrowser);
     this.increasePriority(aBrowser);
 
     windowEntry.lastSelectedBrowser = aBrowser;
   },
 
   // Auxiliary methods
-  getLoadgroup: function(aBrowser) {
+  getLoadgroup: function NP_BH_getLoadgroup(aBrowser) {
     return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
                    .loadGroup.QueryInterface(Ci.nsISupportsPriority);
   },
 
-  increasePriority: function(aBrowser) {
+  increasePriority: function NP_BH_increasePriority(aBrowser) {
     this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA);
   },
 
-  decreasePriority: function(aBrowser) {
+  decreasePriority: function NP_BH_decreasePriority(aBrowser) {
     this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA * -1);
   }
 };
 
 
 // Methods that impact a window. Put into single object for organization.
 let WindowHelper = {
-  addWindow: function(aWindow) {
+  addWindow: function NP_WH_addWindow(aWindow) {
     // Build internal data object
     _windows.push({ window: aWindow, lastSelectedBrowser: null });
 
     // Add event listeners
     TAB_EVENTS.forEach(function(event) {
       aWindow.gBrowser.tabContainer.addEventListener(event, _handleEvent, false);
     });
     WINDOW_EVENTS.forEach(function(event) {
@@ -148,70 +148,70 @@ let WindowHelper = {
       this.handleFocusedWindow(aWindow);
     else
       this.decreasePriority(aWindow);
 
     // Select the selected tab
     BrowserHelper.onSelect(aWindow.gBrowser.selectedBrowser);
   },
 
-  removeWindow: function(aWindow) {
+  removeWindow: function NP_WH_removeWindow(aWindow) {
     if (aWindow == _lastFocusedWindow)
       _lastFocusedWindow = null;
 
     // Delete this window from our tracking
     _windows.splice(this.getEntryIndex(aWindow), 1);
 
     // Remove the event listeners
     TAB_EVENTS.forEach(function(event) {
       aWindow.gBrowser.tabContainer.removeEventListener(event, _handleEvent, false);
     });
     WINDOW_EVENTS.forEach(function(event) {
       aWindow.removeEventListener(event, _handleEvent, false);
     });
   },
 
-  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 (aWindow == _lastFocusedWindow)
       return;
 
     // handleFocusedWindow will deprioritize the current window
     this.handleFocusedWindow(aWindow);
 
     // Lastly we should increase priority for this window
     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 (_lastFocusedWindow)
       this.decreasePriority(_lastFocusedWindow);
 
     // aWindow is now focused
     _lastFocusedWindow = aWindow;
   },
 
   // Auxiliary methods
-  increasePriority: function(aWindow) {
+  increasePriority: function NP_WH_increasePriority(aWindow) {
     aWindow.gBrowser.browsers.forEach(function(aBrowser) {
       BrowserHelper.increasePriority(aBrowser);
     });
   },
 
-  decreasePriority: function(aWindow) {
+  decreasePriority: function NP_WH_decreasePriority(aWindow) {
     aWindow.gBrowser.browsers.forEach(function(aBrowser) {
       BrowserHelper.decreasePriority(aBrowser);
     });
   },
 
-  getEntry: function(aWindow) {
+  getEntry: function NP_WH_getEntry(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
     for (let i = 0; i < _windows.length; i++)
       if (_windows[i].window == aWindow)
         return i;
   }
 };