Bug 1338890 - Cache our tab behaviour instead of requesting it each time on a hot path r=smaug

This commit is contained in:
George Wright
2017-02-17 13:59:12 -05:00
parent 388896e08a
commit 6fac44d239

View File

@@ -76,6 +76,9 @@ MightNeedIMEFocus(const nsWidgetInitData* aInitData)
// Arbitrary, fungible.
const size_t PuppetWidget::kMaxDimension = 4000;
static bool gRemoteDesktopBehaviorEnabled = false;
static bool gRemoteDesktopBehaviorInitialized = false;
NS_IMPL_ISUPPORTS_INHERITED0(PuppetWidget, nsBaseWidget)
PuppetWidget::PuppetWidget(TabChild* aTabChild)
@@ -94,6 +97,11 @@ PuppetWidget::PuppetWidget(TabChild* aTabChild)
// Setting 'Unknown' means "not yet cached".
mInputContext.mIMEState.mEnabled = IMEState::UNKNOWN;
if (!gRemoteDesktopBehaviorInitialized) {
Preferences::AddBoolVarCache(&gRemoteDesktopBehaviorEnabled, "browser.tabs.remote.desktopbehavior", false);
gRemoteDesktopBehaviorInitialized = true;
}
}
PuppetWidget::~PuppetWidget()
@@ -1171,7 +1179,7 @@ PuppetWidget::NeedsPaint()
{
// e10s popups are handled by the parent process, so never should be painted here
if (XRE_IsContentProcess() &&
Preferences::GetBool("browser.tabs.remote.desktopbehavior", false) &&
gRemoteDesktopBehaviorEnabled &&
mWindowType == eWindowType_popup) {
NS_WARNING("Trying to paint an e10s popup in the child process!");
return false;