Bug 1007490 - Adding a dom.ipc.plugins.unloadTimeoutSecs option for indicating timeout in seconds between the moment when all instances for a plugin-container become idle and closing of associated process. r=bsmedberg

This commit is contained in:
Qeole 2014-05-15 15:37:00 +02:00
parent 7de3712fc0
commit 2a32ff58ea
2 changed files with 15 additions and 2 deletions

View File

@ -125,6 +125,11 @@ static const char *kPrefWhitelist = "plugin.allowed_types";
static const char *kPrefDisableFullPage = "plugin.disable_full_page_plugin_for_types";
static const char *kPrefJavaMIME = "plugin.java.mime";
// How long we wait before unloading an idle plugin process.
// Defaults to 30 seconds.
static const char *kPrefUnloadPluginTimeoutSecs = "dom.ipc.plugins.unloadTimeoutSecs";
static const uint32_t kDefaultPluginUnloadingTimeout = 30;
// Version of cached plugin info
// 0.01 first implementation
// 0.02 added caching of CanUnload to fix bug 105935
@ -226,7 +231,7 @@ bool ReadSectionHeader(nsPluginManifestLineReader& reader, const char *token)
static bool UnloadPluginsASAP()
{
return Preferences::GetBool("dom.ipc.plugins.unloadASAP", false);
return (Preferences::GetUint(kPrefUnloadPluginTimeoutSecs, kDefaultPluginUnloadingTimeout) == 0);
}
nsPluginHost::nsPluginHost()
@ -727,7 +732,11 @@ void nsPluginHost::OnPluginInstanceDestroyed(nsPluginTag* aPluginTag)
} else {
aPluginTag->mUnloadTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
}
aPluginTag->mUnloadTimer->InitWithCallback(this, 1000 * 60 * 3, nsITimer::TYPE_ONE_SHOT);
uint32_t unloadTimeout = Preferences::GetUint(kPrefUnloadPluginTimeoutSecs,
kDefaultPluginUnloadingTimeout);
aPluginTag->mUnloadTimer->InitWithCallback(this,
1000 * unloadTimeout,
nsITimer::TYPE_ONE_SHOT);
}
}
}

View File

@ -2060,6 +2060,10 @@ pref("dom.ipc.plugins.java.enabled", false);
pref("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", true);
pref("dom.ipc.plugins.reportCrashURL", true);
// How long we wait before unloading an idle plugin process.
// Defaults to 30 seconds.
pref("dom.ipc.plugins.unloadTimeoutSecs", 30);
pref("dom.ipc.processCount", 1);
// Enable the use of display-lists for SVG hit-testing and painting.