Backout bug 1118618 on a CLOSED TREE
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#include "mozilla/plugins/PluginBridge.h"
|
||||
#include "mozilla/plugins/PluginInstanceParent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ProcessHangMonitor.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/unused.h"
|
||||
@@ -70,7 +69,6 @@ using namespace mozilla::plugins::parent;
|
||||
using namespace CrashReporter;
|
||||
#endif
|
||||
|
||||
static const char kContentTimeoutPref[] = "dom.ipc.plugins.contentTimeoutSecs";
|
||||
static const char kChildTimeoutPref[] = "dom.ipc.plugins.timeoutSecs";
|
||||
static const char kParentTimeoutPref[] = "dom.ipc.plugins.parentTimeoutSecs";
|
||||
static const char kLaunchTimeoutPref[] = "dom.ipc.plugins.processLaunchTimeoutSecs";
|
||||
@@ -261,22 +259,6 @@ PRCList PluginModuleMapping::sModuleListHead =
|
||||
|
||||
bool PluginModuleMapping::sIsLoadModuleOnStack = false;
|
||||
|
||||
void
|
||||
mozilla::plugins::TerminatePlugin(uint32_t aPluginId)
|
||||
{
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst();
|
||||
nsPluginTag* pluginTag = host->PluginWithId(aPluginId);
|
||||
if (!pluginTag || !pluginTag->mPlugin) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<nsNPAPIPlugin> plugin = pluginTag->mPlugin;
|
||||
PluginModuleChromeParent* chromeParent = static_cast<PluginModuleChromeParent*>(plugin->GetLibrary());
|
||||
chromeParent->TerminateChildProcess(MessageLoop::current());
|
||||
}
|
||||
|
||||
/* static */ PluginLibrary*
|
||||
PluginModuleContentParent::LoadModule(uint32_t aPluginId)
|
||||
{
|
||||
@@ -307,8 +289,6 @@ PluginModuleContentParent::LoadModule(uint32_t aPluginId)
|
||||
mapping.forget();
|
||||
}
|
||||
|
||||
parent->mPluginId = aPluginId;
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
@@ -348,8 +328,6 @@ PluginModuleContentParent::Initialize(mozilla::ipc::Transport* aTransport,
|
||||
// all share the same channel.
|
||||
parent->GetIPCChannel()->SetChannelFlags(MessageChannel::REQUIRE_DEFERRED_MESSAGE_PROTECTION);
|
||||
|
||||
TimeoutChanged(kContentTimeoutPref, parent);
|
||||
|
||||
// moduleMapping is linked into PluginModuleMapping::sModuleListHead and is
|
||||
// needed later, so since this function is returning successfully we
|
||||
// forget it here.
|
||||
@@ -539,12 +517,6 @@ PluginModuleParent::~PluginModuleParent()
|
||||
PluginModuleContentParent::PluginModuleContentParent()
|
||||
: PluginModuleParent(false)
|
||||
{
|
||||
Preferences::RegisterCallback(TimeoutChanged, kContentTimeoutPref, this);
|
||||
}
|
||||
|
||||
PluginModuleContentParent::~PluginModuleContentParent()
|
||||
{
|
||||
Preferences::UnregisterCallback(TimeoutChanged, kContentTimeoutPref, this);
|
||||
}
|
||||
|
||||
PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath, uint32_t aPluginId)
|
||||
@@ -678,7 +650,7 @@ PluginModuleChromeParent::WriteExtraDataForMinidump(AnnotationTable& notes)
|
||||
#endif // MOZ_CRASHREPORTER
|
||||
|
||||
void
|
||||
PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
|
||||
PluginModuleChromeParent::SetChildTimeout(const int32_t aChildTimeout)
|
||||
{
|
||||
int32_t timeoutMs = (aChildTimeout > 0) ? (1000 * aChildTimeout) :
|
||||
MessageChannel::kNoTimeout;
|
||||
@@ -686,33 +658,24 @@ PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleParent::TimeoutChanged(const char* aPref, void* aModule)
|
||||
PluginModuleChromeParent::TimeoutChanged(const char* aPref, void* aModule)
|
||||
{
|
||||
PluginModuleParent* module = static_cast<PluginModuleParent*>(aModule);
|
||||
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
#ifndef XP_WIN
|
||||
if (!strcmp(aPref, kChildTimeoutPref)) {
|
||||
MOZ_ASSERT(module->IsChrome());
|
||||
// The timeout value used by the parent for children
|
||||
int32_t timeoutSecs = Preferences::GetInt(kChildTimeoutPref, 0);
|
||||
module->SetChildTimeout(timeoutSecs);
|
||||
static_cast<PluginModuleChromeParent*>(aModule)->SetChildTimeout(timeoutSecs);
|
||||
#else
|
||||
if (!strcmp(aPref, kChildTimeoutPref) ||
|
||||
!strcmp(aPref, kHangUIMinDisplayPref) ||
|
||||
!strcmp(aPref, kHangUITimeoutPref)) {
|
||||
MOZ_ASSERT(module->IsChrome());
|
||||
static_cast<PluginModuleChromeParent*>(module)->EvaluateHangUIState(true);
|
||||
static_cast<PluginModuleChromeParent*>(aModule)->EvaluateHangUIState(true);
|
||||
#endif // XP_WIN
|
||||
} else if (!strcmp(aPref, kParentTimeoutPref)) {
|
||||
// The timeout value used by the child for its parent
|
||||
MOZ_ASSERT(module->IsChrome());
|
||||
int32_t timeoutSecs = Preferences::GetInt(kParentTimeoutPref, 0);
|
||||
unused << static_cast<PluginModuleChromeParent*>(module)->SendSetParentHangTimeout(timeoutSecs);
|
||||
} else if (!strcmp(aPref, kContentTimeoutPref)) {
|
||||
MOZ_ASSERT(!module->IsChrome());
|
||||
int32_t timeoutSecs = Preferences::GetInt(kContentTimeoutPref, 0);
|
||||
module->SetChildTimeout(timeoutSecs);
|
||||
unused << static_cast<PluginModuleChromeParent*>(aModule)->SendSetParentHangTimeout(timeoutSecs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,23 +859,6 @@ PluginModuleChromeParent::ShouldContinueFromReplyTimeout()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
PluginModuleContentParent::ShouldContinueFromReplyTimeout()
|
||||
{
|
||||
nsRefPtr<ProcessHangMonitor> monitor = ProcessHangMonitor::Get();
|
||||
if (!monitor) {
|
||||
return true;
|
||||
}
|
||||
monitor->NotifyPluginHang(mPluginId);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleContentParent::OnExitedSyncSend()
|
||||
{
|
||||
ProcessHangMonitor::ClearHang();
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user