virtual void Notify(const SwitchEvent& aEvent) { DBG("UsbCable switch device: %d state: %s\n", aEvent.device(), SwitchStateStr(aEvent)); XRE_GetIOMessageLoop()->PostTask( FROM_HERE, NewRunnableFunction(UsbCableEventIOThread)); }
void NotifySwitchChange(const SwitchEvent& aEvent) { // When callback this notification, main thread may call unregister function // first. We should check if this pointer is valid. if (!sSwitchObserverLists) return; SwitchObserverList& observer = GetSwitchObserverList(aEvent.device()); observer.Broadcast(aEvent); }