Bug 544945, part 2: Periodically unblock the parent to allow it to process events while the plugin subprocess is in a nested event loop. r=karlt
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsNPAPIPlugin.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
using base::KillProcess;
|
||||
|
||||
@@ -837,3 +838,35 @@ PluginModuleParent::AnswerNPN_GetValue_WithBoolReturn(const NPNVariable& aVariab
|
||||
*aBoolVal = boolVal ? true : false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(MOZ_WIDGET_GTK2)
|
||||
bool
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
NS_RUNTIMEABORT("unreached");
|
||||
return false;
|
||||
}
|
||||
|
||||
#else
|
||||
static const int kMaxChancesToProcessEvents = 20;
|
||||
|
||||
bool
|
||||
PluginModuleParent::AnswerProcessSomeEvents()
|
||||
{
|
||||
PLUGIN_LOG_DEBUG(("Spinning mini nested loop ..."));
|
||||
|
||||
// XXX it would seem sensical to make the condition be
|
||||
// |NS_HasPendingEvents() && i < kMaxEventsToProcess|. The
|
||||
// problem is, the native appshell is just an observer of our
|
||||
// nsThread, and processes native events as a side effect of
|
||||
// nsThread::ProcessNextEvent(). Since native events are the ones
|
||||
// we really care about here, we need to go straight to
|
||||
// NS_ProcessNextEvent().
|
||||
for (int i = 0; i < kMaxChancesToProcessEvents; ++i)
|
||||
NS_ProcessNextEvent(nsnull, PR_FALSE);
|
||||
|
||||
PLUGIN_LOG_DEBUG(("... quitting mini nested loop"));
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user