namespace slideshow::internal
{ bool EventQueue::EventEntry::operator<( const EventEntry& rEvent ) const
{ // negate comparison, we want priority queue to be sorted // in increasing order of activation times return nTime > rEvent.nTime;
}
EventQueue::~EventQueue()
{ // add in all that have been added explicitly for this round: for ( constauto& rEvent : maNextEvents )
{
maEvents.push(rEvent);
}
EventEntryVector().swap( maNextEvents );
// A seemingly obvious optimization cannot be used here, // because it breaks assumed order of notification: zero // timeout events could be fired() immediately, but that // would not unwind the stack and furthermore changes // order of notification
// add in all that have been added explicitly for this round: for ( constauto& rEvent : maNextEvents ) {
maEvents.push(rEvent);
}
EventEntryVector().swap( maNextEvents );
// When maEvents does not contain any events that are due now // then process one event from maNextNextEvents. if (!maNextNextEvents.empty()
&& !bFireAllEvents
&& (maEvents.empty() || maEvents.top().nTime > nCurrTime))
{ const EventEntry aEvent (maNextNextEvents.top());
maNextNextEvents.pop();
maEvents.push(aEvent);
}
// process ready/elapsed events. Note that the 'perceived' // current time remains constant for this loop, thus we're // processing only those events which where ready when we // entered this method. while( !maEvents.empty() &&
(bFireAllEvents || maEvents.top().nTime <= nCurrTime) )
{
EventEntry event( maEvents.top() );
maEvents.pop();
// only process event, if it is still 'charged', // i.e. the fire() call effects something. This is // used when e.g. having events registered at multiple // places, which should fire only once: after the // initial fire() call, those events become inactive // and return false on isCharged. This frees us from // the need to prune queues of those inactive shells. if( event.pEvent->isCharged() )
{
aGuard.unlock(); try
{
SAL_INFO("slideshow.eventqueue", "firing event \""
<< event.pEvent->GetDescription()
<< "\" [" << event.pEvent.get()
<< "] at " << mpTimer->getElapsedTime()
<< " with delay " << event.pEvent->getActivationTime(0.0)
);
event.pEvent->fire();
SAL_INFO("slideshow.eventqueue", "event \""
<< event.pEvent->GetDescription()
<< "\" [" << event.pEvent.get() << "] fired"
);
} catch( uno::RuntimeException& )
{ throw;
} catch( uno::Exception& )
{ // catch anything here, we don't want // to leave this scope under _any_ // circumstance. Although, do _not_ // reinsert an activity that threw // once.
// NOTE: we explicitly don't catch(...) here, // since this will also capture segmentation // violations and the like. In such a case, we // still better let our clients now...
TOOLS_WARN_EXCEPTION( "slideshow", "" );
} catch( SlideShowException& )
{ // catch anything here, we don't want // to leave this scope under _any_ // circumstance. Although, do _not_ // reinsert an activity that threw // once.
// NOTE: we explicitly don't catch(...) here, // since this will also capture segmentation // violations and the like. In such a case, we // still better let our clients now...
SAL_WARN("slideshow.eventqueue", "::presentation::internal::EventQueue: Event threw a SlideShowException, action might not have been fully performed" );
}
aGuard.lock();
} else
{
SAL_INFO( "slideshow.eventqueue", "Ignoring discharged event: unknown ("
<< event.pEvent.get() << "), timeout was: "
<< event.pEvent->getActivationTime(0.0));
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.