Backing out bug 550026 due to orange
This commit is contained in:
@@ -67,6 +67,24 @@ struct RunnableMethodTraits<mozilla::plugins::PluginModuleParent>
|
||||
static void ReleaseCallee(Class* obj) { }
|
||||
};
|
||||
|
||||
class PluginCrashed : public nsRunnable
|
||||
{
|
||||
public:
|
||||
PluginCrashed(nsNPAPIPlugin* plugin,
|
||||
const nsString& dumpID)
|
||||
: mDumpID(dumpID),
|
||||
mPlugin(plugin) { }
|
||||
|
||||
NS_IMETHOD Run() {
|
||||
mPlugin->PluginCrashed(mDumpID);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsNPAPIPlugin* mPlugin;
|
||||
nsString mDumpID;
|
||||
};
|
||||
|
||||
// static
|
||||
PluginLibrary*
|
||||
PluginModuleParent::LoadModule(const char* aFilePath)
|
||||
@@ -91,7 +109,6 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
|
||||
, mNPNIface(NULL)
|
||||
, mPlugin(NULL)
|
||||
, mProcessStartTime(time(NULL))
|
||||
, mPluginCrashedTask(NULL)
|
||||
{
|
||||
NS_ASSERTION(mSubprocess, "Out of memory!");
|
||||
|
||||
@@ -104,13 +121,6 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
|
||||
|
||||
PluginModuleParent::~PluginModuleParent()
|
||||
{
|
||||
NS_ASSERTION(OkToCleanup(), "unsafe destruction");
|
||||
|
||||
if (mPluginCrashedTask) {
|
||||
mPluginCrashedTask->Cancel();
|
||||
mPluginCrashedTask = 0;
|
||||
}
|
||||
|
||||
if (!mShutdown) {
|
||||
NS_WARNING("Plugin host deleted the module without shutting down.");
|
||||
NPError err;
|
||||
@@ -256,11 +266,12 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
|
||||
switch (why) {
|
||||
case AbnormalShutdown: {
|
||||
nsCOMPtr<nsIFile> dump;
|
||||
nsAutoString dumpID;
|
||||
if (GetMinidump(getter_AddRefs(dump))) {
|
||||
WriteExtraDataForMinidump(dump);
|
||||
if (NS_SUCCEEDED(dump->GetLeafName(mDumpID))) {
|
||||
mDumpID.Replace(mDumpID.Length() - 4, 4,
|
||||
NS_LITERAL_STRING(""));
|
||||
if (NS_SUCCEEDED(dump->GetLeafName(dumpID))) {
|
||||
dumpID.Replace(dumpID.Length() - 4, 4,
|
||||
NS_LITERAL_STRING(""));
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -271,9 +282,9 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
|
||||
// Defer the PluginCrashed method so that we don't re-enter
|
||||
// and potentially modify the actor child list while enumerating it.
|
||||
if (mPlugin) {
|
||||
mPluginCrashedTask = NewRunnableMethod(
|
||||
this, &PluginModuleParent::NotifyPluginCrashed);
|
||||
MessageLoop::current()->PostTask(FROM_HERE, mPluginCrashedTask);
|
||||
nsCOMPtr<nsIRunnable> r =
|
||||
new PluginCrashed(mPlugin, dumpID);
|
||||
NS_DispatchToMainThread(r);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -286,24 +297,6 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PluginModuleParent::NotifyPluginCrashed()
|
||||
{
|
||||
// MessageLoop owns this
|
||||
mPluginCrashedTask = NULL;
|
||||
|
||||
if (!OkToCleanup()) {
|
||||
// there's still plugin code on the C++ stack. try again
|
||||
mPluginCrashedTask = NewRunnableMethod(
|
||||
this, &PluginModuleParent::NotifyPluginCrashed);
|
||||
MessageLoop::current()->PostTask(FROM_HERE, mPluginCrashedTask);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPlugin)
|
||||
mPlugin->PluginCrashed(mDumpID);
|
||||
}
|
||||
|
||||
PPluginInstanceParent*
|
||||
PluginModuleParent::AllocPPluginInstance(const nsCString& aMimeType,
|
||||
const uint16_t& aMode,
|
||||
|
||||
Reference in New Issue
Block a user