mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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
--HG-- extra : rebase_source : bf9a2df9d7d6b420fb93d11dc5abaeb4be1214db
This commit is contained in:
parent
eb662c9fe6
commit
06871df7a3
@ -93,6 +93,12 @@ parent:
|
||||
rpc NPN_GetValue_WithBoolReturn(NPNVariable aVariable)
|
||||
returns (NPError aError,
|
||||
bool aBoolVal);
|
||||
|
||||
// Wake up and process a few native events. Periodically called by
|
||||
// Gtk-specific code upon detecting that the plugin process has
|
||||
// entered a nested event loop. If the browser doesn't process
|
||||
// native events, then "livelock" and some other glitches can occur.
|
||||
rpc ProcessSomeEvents();
|
||||
};
|
||||
|
||||
} // namespace plugins
|
||||
|
@ -290,7 +290,7 @@ PluginModuleChild::ProcessBrowserEvents(gpointer data)
|
||||
|
||||
PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data);
|
||||
|
||||
PLUGIN_LOG_DEBUG(("FIXME/bug 544945: rpc-call to browser to process a few events"));
|
||||
pmc->CallProcessSomeEvents();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -154,6 +154,9 @@ protected:
|
||||
NPError* aError,
|
||||
bool* aBoolVal);
|
||||
|
||||
NS_OVERRIDE
|
||||
virtual bool AnswerProcessSomeEvents();
|
||||
|
||||
static PluginInstanceParent* InstCast(NPP instance);
|
||||
static BrowserStreamParent* StreamCast(NPP instance, NPStream* s);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user