зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135491: Part 1 - Add functions to notify plugin when a plugin destroy will be deferred; r=jimm
--HG-- extra : rebase_source : 20024e084d3a1c60c3ae14934ea46310c288949e
This commit is contained in:
Родитель
ca9369a50d
Коммит
30dc911b8c
|
@ -1468,6 +1468,23 @@ nsPluginInstanceOwner::NotifyHostCreateWidget()
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsPluginInstanceOwner::NotifyDestroyPending()
|
||||
{
|
||||
if (!mInstance) {
|
||||
return;
|
||||
}
|
||||
bool isOOP = false;
|
||||
if (NS_FAILED(mInstance->GetIsOOP(&isOOP)) || !isOOP) {
|
||||
return;
|
||||
}
|
||||
NPP npp = nullptr;
|
||||
if (NS_FAILED(mInstance->GetNPP(&npp)) || !npp) {
|
||||
return;
|
||||
}
|
||||
PluginAsyncSurrogate::NotifyDestroyPending(npp);
|
||||
}
|
||||
|
||||
nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
|
|
@ -258,6 +258,7 @@ public:
|
|||
|
||||
void NotifyHostAsyncInitFailed();
|
||||
void NotifyHostCreateWidget();
|
||||
void NotifyDestroyPending();
|
||||
|
||||
private:
|
||||
virtual ~nsPluginInstanceOwner();
|
||||
|
|
|
@ -99,6 +99,7 @@ PluginAsyncSurrogate::PluginAsyncSurrogate(PluginModuleParent* aParent)
|
|||
, mInstantiated(false)
|
||||
, mAsyncSetWindow(false)
|
||||
, mInitCancelled(false)
|
||||
, mDestroyPending(false)
|
||||
, mAsyncCallsInFlight(0)
|
||||
{
|
||||
MOZ_ASSERT(aParent);
|
||||
|
@ -179,9 +180,27 @@ PluginAsyncSurrogate::NP_GetEntryPoints(NPPluginFuncs* aFuncs)
|
|||
aFuncs->asfile = &PluginModuleParent::NPP_StreamAsFile;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
PluginAsyncSurrogate::NotifyDestroyPending(NPP aInstance)
|
||||
{
|
||||
PluginAsyncSurrogate* surrogate = Cast(aInstance);
|
||||
if (!surrogate) {
|
||||
return;
|
||||
}
|
||||
surrogate->NotifyDestroyPending();
|
||||
}
|
||||
|
||||
void
|
||||
PluginAsyncSurrogate::NotifyDestroyPending()
|
||||
{
|
||||
mDestroyPending = true;
|
||||
nsJSNPRuntime::OnPluginDestroyPending(mInstance);
|
||||
}
|
||||
|
||||
NPError
|
||||
PluginAsyncSurrogate::NPP_Destroy(NPSavedData** aSave)
|
||||
{
|
||||
NotifyDestroyPending();
|
||||
if (!WaitForInit()) {
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
static const NPClass* GetClass() { return &sNPClass; }
|
||||
static void NP_GetEntryPoints(NPPluginFuncs* aFuncs);
|
||||
static PluginAsyncSurrogate* Cast(NPP aInstance);
|
||||
static void NotifyDestroyPending(NPP aInstance);
|
||||
void NotifyDestroyPending();
|
||||
|
||||
virtual PluginAsyncSurrogate*
|
||||
GetAsyncSurrogate() { return this; }
|
||||
|
@ -63,8 +65,9 @@ public:
|
|||
bool* aHasProperty, bool* aHasMethod,
|
||||
NPVariant* aResult);
|
||||
|
||||
PluginModuleParent*
|
||||
GetParent() { return mParent; }
|
||||
PluginModuleParent* GetParent() { return mParent; }
|
||||
|
||||
bool IsDestroyPending() const { return mDestroyPending; }
|
||||
|
||||
bool SetAcceptingCalls(bool aAccept)
|
||||
{
|
||||
|
@ -151,6 +154,7 @@ private:
|
|||
bool mInstantiated;
|
||||
bool mAsyncSetWindow;
|
||||
bool mInitCancelled;
|
||||
bool mDestroyPending;
|
||||
int32_t mAsyncCallsInFlight;
|
||||
|
||||
static const NPClass sNPClass;
|
||||
|
|
Загрузка…
Ссылка в новой задаче