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

This commit is contained in:
James Willcox
2012-12-10 10:00:44 -05:00
parent 6d58af02b3
commit 47f806cfae
2 changed files with 0 additions and 34 deletions

View File

@@ -1396,28 +1396,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)
{
@@ -1425,11 +1403,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.
@@ -1466,7 +1440,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
@@ -1504,12 +1477,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();