Bug 666804 - [e10s] Support NetworkPrioritizer (r=felipe)

This commit is contained in:
Bill McCloskey 2014-03-11 20:13:48 -07:00
parent 0245244bfd
commit 96f886f1cf
5 changed files with 29 additions and 14 deletions

View File

@ -1093,12 +1093,9 @@ var gBrowserInit = {
if (!getBoolPref("ui.click_hold_context_menus", false))
SetClickAndHoldHandlers();
// Bug 666804 - NetworkPrioritizer support for e10s
if (!gMultiProcessBrowser) {
let NP = {};
Cu.import("resource:///modules/NetworkPrioritizer.jsm", NP);
NP.trackBrowserWindow(window);
}
let NP = {};
Cu.import("resource:///modules/NetworkPrioritizer.jsm", NP);
NP.trackBrowserWindow(window);
PlacesToolbarHelper.init();

View File

@ -80,18 +80,12 @@ let BrowserHelper = {
windowEntry.lastSelectedBrowser = aBrowser;
},
// Auxiliary methods
getLoadgroup: function NP_BH_getLoadgroup(aBrowser) {
return aBrowser.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority);
},
increasePriority: function NP_BH_increasePriority(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA);
aBrowser.adjustPriority(PRIORITY_DELTA);
},
decreasePriority: function NP_BH_decreasePriority(aBrowser) {
this.getLoadgroup(aBrowser).adjustPriority(PRIORITY_DELTA * -1);
aBrowser.adjustPriority(PRIORITY_DELTA * -1);
}
};

View File

@ -286,6 +286,13 @@ addMessageListener("History:UseGlobalHistory", function (aMessage) {
docShell.useGlobalHistory = aMessage.data.enabled;
});
addMessageListener("NetworkPrioritizer:AdjustPriority", (msg) => {
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
let loadGroup = webNav.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority);
loadGroup.adjustPriority(msg.data.adjustment);
});
let AutoCompletePopup = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup]),

View File

@ -674,6 +674,15 @@
</setter>
</property>
<method name="adjustPriority">
<parameter name="adjustment"/>
<body><![CDATA[
let loadGroup = this.webNavigation.QueryInterface(Ci.nsIDocumentLoader)
.loadGroup.QueryInterface(Ci.nsISupportsPriority);
loadGroup.adjustPriority(adjustment);
]]></body>
</method>
<!--
This field tracks the location bar state. The value that the user typed
in to the location bar may not be changed while this field is zero.

View File

@ -31,6 +31,14 @@
]]></getter>
</property>
<method name="adjustPriority">
<parameter name="adjustment"/>
<body><![CDATA[
this.messageManager.sendAsyncMessage("NetworkPrioritizer:AdjustPriority",
{adjustment: adjustment});
]]></body>
</method>
<field name="_remoteWebNavigation">null</field>
<property name="webNavigation"