Bug 800838 - Remove unnecessary delay when unscheduling plugin timers on Android r=blassey a=bajaj

This commit is contained in:
James Willcox 2012-12-10 10:00:44 -05:00
Родитель 20254aed91
Коммит 8e66dde61a
2 изменённых файлов: 0 добавлений и 34 удалений

Просмотреть файл

@ -1389,28 +1389,6 @@ nsNPAPIPluginInstance::PrivateModeStateChanged(bool enabled)
return (error == NPERR_NO_ERROR) ? NS_OK : NS_ERROR_FAILURE;
}
class DelayUnscheduleEvent : public nsRunnable {
public:
nsRefPtr<nsNPAPIPluginInstance> mInstance;
uint32_t mTimerID;
DelayUnscheduleEvent(nsNPAPIPluginInstance* aInstance, uint32_t aTimerId)
: mInstance(aInstance)
, mTimerID(aTimerId)
{}
~DelayUnscheduleEvent() {}
NS_IMETHOD Run();
};
NS_IMETHODIMP
DelayUnscheduleEvent::Run()
{
mInstance->UnscheduleTimer(mTimerID);
return NS_OK;
}
static void
PluginTimerCallback(nsITimer *aTimer, void *aClosure)
{
@ -1418,11 +1396,7 @@ PluginTimerCallback(nsITimer *aTimer, void *aClosure)
NPP npp = t->npp;
uint32_t id = t->id;
// Some plugins (Flash on Android) calls unscheduletimer
// from this callback.
t->inCallback = true;
(*(t->callback))(npp, id);
t->inCallback = false;
// Make sure we still have an instance and the timer is still alive
// after the callback.
@ -1459,7 +1433,6 @@ nsNPAPIPluginInstance::ScheduleTimer(uint32_t interval, NPBool repeat, void (*ti
nsNPAPITimer *newTimer = new nsNPAPITimer();
newTimer->inCallback = false;
newTimer->npp = &mNPP;
// generate ID that is unique to this instance
@ -1497,12 +1470,6 @@ nsNPAPIPluginInstance::UnscheduleTimer(uint32_t timerID)
if (!t)
return;
if (t->inCallback) {
nsCOMPtr<nsIRunnable> e = new DelayUnscheduleEvent(this, timerID);
NS_DispatchToCurrentThread(e);
return;
}
// cancel the timer
t->timer->Cancel();

Просмотреть файл

@ -57,7 +57,6 @@ public:
uint32_t id;
nsCOMPtr<nsITimer> timer;
void (*callback)(NPP npp, uint32_t timerID);
bool inCallback;
};
class nsNPAPIPluginInstance : public nsISupports