Kaydet (Commit) db5d4214 authored tarafından David Tardon's avatar David Tardon

always set event description

Change-Id: I8d83c0d65fff0b0d3d08f32aa3d5c0bb5e7e9c8a
üst 112b481a
...@@ -91,13 +91,11 @@ namespace slideshow ...@@ -91,13 +91,11 @@ namespace slideshow
{ {
::osl::MutexGuard aGuard( maMutex ); ::osl::MutexGuard aGuard( maMutex );
#if OSL_DEBUG_LEVEL > 1
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription() SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
<< "\" [" << rEvent.get() << "\" [" << rEvent.get()
<< "] at " << mpTimer->getElapsedTime() << "] at " << mpTimer->getElapsedTime()
<< " with delay " << rEvent->getActivationTime(0.0) << " with delay " << rEvent->getActivationTime(0.0)
); );
#endif
ENSURE_OR_RETURN_FALSE( rEvent, ENSURE_OR_RETURN_FALSE( rEvent,
"EventQueue::addEvent: event ptr NULL" ); "EventQueue::addEvent: event ptr NULL" );
...@@ -119,13 +117,11 @@ namespace slideshow ...@@ -119,13 +117,11 @@ namespace slideshow
{ {
::osl::MutexGuard aGuard( maMutex ); ::osl::MutexGuard aGuard( maMutex );
#if OSL_DEBUG_LEVEL > 1
SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription() SAL_INFO("slideshow.eventqueue", "adding event \"" << rEvent->GetDescription()
<< "\" [" << rEvent.get() << "\" [" << rEvent.get()
<< "] for the next round at " << mpTimer->getElapsedTime() << "] for the next round at " << mpTimer->getElapsedTime()
<< " with delay " << rEvent->getActivationTime(0.0) << " with delay " << rEvent->getActivationTime(0.0)
); );
#endif
ENSURE_OR_RETURN_FALSE( rEvent.get() != NULL, ENSURE_OR_RETURN_FALSE( rEvent.get() != NULL,
"EventQueue::addEvent: event ptr NULL" ); "EventQueue::addEvent: event ptr NULL" );
...@@ -139,13 +135,11 @@ namespace slideshow ...@@ -139,13 +135,11 @@ namespace slideshow
{ {
::osl::MutexGuard aGuard( maMutex ); ::osl::MutexGuard aGuard( maMutex );
#if OSL_DEBUG_LEVEL > 1
SAL_INFO("slideshow.eventqueue", "adding event \"" << rpEvent->GetDescription() SAL_INFO("slideshow.eventqueue", "adding event \"" << rpEvent->GetDescription()
<< "\" [" << rpEvent.get() << "\" [" << rpEvent.get()
<< "] for execution when the queue is empty at " << mpTimer->getElapsedTime() << "] for execution when the queue is empty at " << mpTimer->getElapsedTime()
<< " with delay " << rpEvent->getActivationTime(0.0) << " with delay " << rpEvent->getActivationTime(0.0)
); );
#endif
ENSURE_OR_RETURN_FALSE( ENSURE_OR_RETURN_FALSE(
rpEvent.get() != NULL, rpEvent.get() != NULL,
...@@ -222,20 +216,12 @@ namespace slideshow ...@@ -222,20 +216,12 @@ namespace slideshow
{ {
try try
{ {
#if OSL_DEBUG_LEVEL > 0
VERBOSE_TRACE( "Firing event: unknown (0x%X), timeout was: %f",
event.pEvent.get(),
event.pEvent->getActivationTime(0.0) );
#endif
#if OSL_DEBUG_LEVEL > 1
SAL_INFO("slideshow.eventqueue", "firing event \"" SAL_INFO("slideshow.eventqueue", "firing event \""
<< event.pEvent->GetDescription() << event.pEvent->GetDescription()
<< "\" [" << event.pEvent.get() << "\" [" << event.pEvent.get()
<< "] at " << mpTimer->getElapsedTime() << "] at " << mpTimer->getElapsedTime()
<< " with delay " << event.pEvent->getActivationTime(0.0) << " with delay " << event.pEvent->getActivationTime(0.0)
); );
#endif
event.pEvent->fire(); event.pEvent->fire();
SAL_INFO("slideshow.eventqueue", "event \"" SAL_INFO("slideshow.eventqueue", "event \""
<< event.pEvent->GetDescription() << event.pEvent->GetDescription()
......
...@@ -60,9 +60,7 @@ public: ...@@ -60,9 +60,7 @@ public:
WakeupEvent( boost::shared_ptr< ::canvas::tools::ElapsedTime > const& pTimeBase, WakeupEvent( boost::shared_ptr< ::canvas::tools::ElapsedTime > const& pTimeBase,
ActivitySharedPtr const& rActivity, ActivitySharedPtr const& rActivity,
ActivitiesQueue & rActivityQueue ) : ActivitiesQueue & rActivityQueue ) :
#if OSL_DEBUG_LEVEL > 1 Event("WakeupEvent"),
Event(::rtl::OUString("WakeupEvent")),
#endif
maTimer(pTimeBase), maTimer(pTimeBase),
mnNextTime(0.0), mnNextTime(0.0),
mpActivity(rActivity), mpActivity(rActivity),
......
...@@ -32,9 +32,7 @@ namespace slideshow ...@@ -32,9 +32,7 @@ namespace slideshow
WakeupEvent::WakeupEvent( WakeupEvent::WakeupEvent(
boost::shared_ptr<canvas::tools::ElapsedTime> const & pTimeBase, boost::shared_ptr<canvas::tools::ElapsedTime> const & pTimeBase,
ActivitiesQueue& rActivityQueue ) : ActivitiesQueue& rActivityQueue ) :
#if OSL_DEBUG_LEVEL > 1 Event("WakeupEvent"),
Event(::rtl::OUString("WakeupEvent")),
#endif
maTimer(pTimeBase), maTimer(pTimeBase),
mnNextTime(0.0), mnNextTime(0.0),
mpActivity(), mpActivity(),
......
...@@ -37,22 +37,14 @@ public: ...@@ -37,22 +37,14 @@ public:
template <typename FuncT> template <typename FuncT>
Delay( FuncT const& func, Delay( FuncT const& func,
double nTimeout double nTimeout
#if OSL_DEBUG_LEVEL > 1
, const ::rtl::OUString& rsDescription , const ::rtl::OUString& rsDescription
) : Event(rsDescription), ) : Event(rsDescription),
#else
) :
#endif
mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {} mnTimeout(nTimeout), maFunc(func), mbWasFired(false) {}
Delay( const boost::function0<void>& func, Delay( const boost::function0<void>& func,
double nTimeout double nTimeout
#if OSL_DEBUG_LEVEL > 1
, const ::rtl::OUString& rsDescription , const ::rtl::OUString& rsDescription
) : Event(rsDescription), ) : Event(rsDescription),
#else
) :
#endif
mnTimeout(nTimeout), mnTimeout(nTimeout),
maFunc(func), maFunc(func),
mbWasFired(false) {} mbWasFired(false) {}
...@@ -83,9 +75,9 @@ private: ...@@ -83,9 +75,9 @@ private:
@return generated delay event @return generated delay event
*/ */
template <typename FuncT> template <typename FuncT>
inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout ) inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout, rtl::OUString const& rsDescription )
{ {
return EventSharedPtr( new Delay( func, nTimeout ) ); return EventSharedPtr( new Delay( func, nTimeout, rsDescription ) );
} }
/** Generate immediate event /** Generate immediate event
...@@ -96,15 +88,14 @@ inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout ) ...@@ -96,15 +88,14 @@ inline EventSharedPtr makeDelay_( FuncT const& func, double nTimeout )
@return generated immediate event. @return generated immediate event.
*/ */
template <typename FuncT> template <typename FuncT>
inline EventSharedPtr makeEvent_( FuncT const& func ) inline EventSharedPtr makeEvent_( FuncT const& func, rtl::OUString const& rsDescription)
{ {
return EventSharedPtr( new Delay( func, 0.0 ) ); return EventSharedPtr( new Delay( func, 0.0, rsDescription ) );
} }
// Strip away description. #define makeDelay(f, t, d) makeDelay_(f, t, d)
#define makeDelay(f, t, d) makeDelay_(f, t) #define makeEvent(f, d) makeEvent_(f, d)
#define makeEvent(f, d) makeEvent_(f)
#else // OSL_DEBUG_LEVEL > 1 #else // OSL_DEBUG_LEVEL > 1
...@@ -135,10 +126,10 @@ inline EventSharedPtr makeDelay_( ...@@ -135,10 +126,10 @@ inline EventSharedPtr makeDelay_(
#define makeDelay(f, t, d) makeDelay_(f, t, \ #define makeDelay(f, t, d) makeDelay_(f, t, \
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d))) d)
#define makeEvent(f, d) makeDelay_(f, 0.0, \ #define makeEvent(f, d) makeDelay_(f, 0.0, \
BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \ BOOST_CURRENT_FUNCTION, __FILE__, __LINE__, \
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(d))) d)
#endif // OSL_DEBUG_LEVEL <= 1 #endif // OSL_DEBUG_LEVEL <= 1
......
...@@ -32,9 +32,7 @@ namespace internal { ...@@ -32,9 +32,7 @@ namespace internal {
class Event : public Disposable class Event : public Disposable
{ {
public: public:
#if OSL_DEBUG_LEVEL > 1 Event (const ::rtl::OUString& rsDescription) : msDescription(rsDescription) {}
Event (const ::rtl::OUString& rsDescription) : msDescription(rsDescription) {};
#endif
/** Execute the event. /** Execute the event.
...@@ -66,12 +64,10 @@ public: ...@@ -66,12 +64,10 @@ public:
*/ */
virtual double getActivationTime( double nCurrentTime ) const = 0; virtual double getActivationTime( double nCurrentTime ) const = 0;
#if OSL_DEBUG_LEVEL > 1 const ::rtl::OUString& GetDescription (void) const { return msDescription; }
::rtl::OUString GetDescription (void) const { return msDescription; }
private: private:
const ::rtl::OUString msDescription; const ::rtl::OUString msDescription;
#endif
}; };
typedef ::boost::shared_ptr< Event > EventSharedPtr; typedef ::boost::shared_ptr< Event > EventSharedPtr;
......
...@@ -38,9 +38,7 @@ namespace slideshow ...@@ -38,9 +38,7 @@ namespace slideshow
public: public:
DelayFacade( const EventSharedPtr& rEvent, DelayFacade( const EventSharedPtr& rEvent,
double nTimeout ) : double nTimeout ) :
#if OSL_DEBUG_LEVEL > 1 Event("DelayFacade"),
Event(::rtl::OUString("DelayFacade")),
#endif
mpEvent( rEvent ), mpEvent( rEvent ),
mnTimeout( nTimeout ) mnTimeout( nTimeout )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment