projects
/
platform
/
core
/
uifw
/
dali-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add trace log to NotificationManager::ProcessMessages
[platform/core/uifw/dali-core.git]
/
dali
/
internal
/
event
/
common
/
notification-manager.cpp
diff --git
a/dali/internal/event/common/notification-manager.cpp
b/dali/internal/event/common/notification-manager.cpp
index
0c0d30c
..
828586a
100644
(file)
--- a/
dali/internal/event/common/notification-manager.cpp
+++ b/
dali/internal/event/common/notification-manager.cpp
@@
-18,70
+18,59
@@
// CLASS HEADER
#include <dali/internal/event/common/notification-manager.h>
// CLASS HEADER
#include <dali/internal/event/common/notification-manager.h>
-// EXTERNAL INCLUDES
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wall"
-
-#include <boost/thread/mutex.hpp>
-
-#pragma clang diagnostic pop
-#else
-
-#include <boost/thread/mutex.hpp>
-
-#endif // __clang__
-
// INTERNAL INCLUDES
// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/internal/common/owner-container.h>
+#include <dali/devel-api/common/owner-container.h>
+#include <dali/devel-api/threading/mutex.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
#include <dali/internal/common/message.h>
#include <dali/internal/common/message.h>
-#include <dali/internal/event/common/property-notification-impl.h>
#include <dali/internal/event/common/complete-notification-interface.h>
#include <dali/internal/event/common/complete-notification-interface.h>
+#include <dali/internal/event/common/property-notification-impl.h>
+#include <dali/public-api/common/dali-common.h>
namespace Dali
{
namespace Dali
{
-
namespace Internal
{
namespace Internal
{
-
namespace
{
namespace
{
-typedef Dali::Vector< CompleteNotificationInterface* > InterfaceContainer;
+typedef Dali::Vector<CompleteNotificationInterface*> InterfaceContainer;
+
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
/**
* helper to move elements from one container to another
* @param from where to move
* @param to move target
*/
/**
* helper to move elements from one container to another
* @param from where to move
* @param to move target
*/
-void MoveElements(
InterfaceContainer& from, InterfaceContainer& to
)
+void MoveElements(
InterfaceContainer& from, InterfaceContainer& to
)
{
// check if there's something in from
const InterfaceContainer::SizeType fromCount = from.Count();
{
// check if there's something in from
const InterfaceContainer::SizeType fromCount = from.Count();
- if(
fromCount > 0u
)
+ if(
fromCount > 0u
)
{
// check if to has some elements
const InterfaceContainer::SizeType toCount = to.Count();
{
// check if to has some elements
const InterfaceContainer::SizeType toCount = to.Count();
- if(
toCount == 0u
)
+ if(
toCount == 0u
)
{
// to is empty so we can swap with from
{
// to is empty so we can swap with from
- to.Swap(
from
);
+ to.Swap(
from
);
}
else
{
}
else
{
- to.Reserve(
toCount + fromCount
);
- for(
InterfaceContainer::SizeType i = 0; i < fromCount; ++i
)
+ to.Reserve(
toCount + fromCount
);
+ for(
InterfaceContainer::SizeType i = 0; i < fromCount; ++i
)
{
{
- to.PushBack(
from[ i ]
);
+ to.PushBack(
from[i]
);
}
from.Clear();
}
}
}
}
from.Clear();
}
}
}
-}
+}
// namespace
-
typedef boost::mutex MessageQueue
Mutex;
-
typedef OwnerContainer< MessageBase* > MessageContainer
;
+
using MessageQueueMutex = Dali::
Mutex;
+
using MessageContainer = OwnerContainer<MessageBase*>
;
struct NotificationManager::Impl
{
struct NotificationManager::Impl
{
@@
-89,19
+78,17
@@
struct NotificationManager::Impl
{
// reserve space on the vectors to avoid reallocs
// applications typically have up-to 20-30 notifications at startup
{
// reserve space on the vectors to avoid reallocs
// applications typically have up-to 20-30 notifications at startup
- updateCompletedMessageQueue.Reserve(
32
);
- updateWorkingMessageQueue.Reserve(
32
);
- eventMessageQueue.Reserve(
32
);
+ updateCompletedMessageQueue.Reserve(
32
);
+ updateWorkingMessageQueue.Reserve(
32
);
+ eventMessageQueue.Reserve(
32
);
// only a few manager objects get complete notifications (animation, render list, property notifications, ...)
// only a few manager objects get complete notifications (animation, render list, property notifications, ...)
- updateCompletedInterfaceQueue.Reserve(
4
);
- updateWorkingInterfaceQueue.Reserve(
4
);
- eventInterfaceQueue.Reserve(
4
);
+ updateCompletedInterfaceQueue.Reserve(
4
);
+ updateWorkingInterfaceQueue.Reserve(
4
);
+ eventInterfaceQueue.Reserve(
4
);
}
}
- ~Impl()
- {
- }
+ ~Impl() = default;
// queueMutex must be locked whilst accessing queue
MessageQueueMutex queueMutex;
// queueMutex must be locked whilst accessing queue
MessageQueueMutex queueMutex;
@@
-125,78
+112,88
@@
NotificationManager::~NotificationManager()
delete mImpl;
}
delete mImpl;
}
-void NotificationManager::QueueCompleteNotification(
CompleteNotificationInterface* instance
)
+void NotificationManager::QueueCompleteNotification(
CompleteNotificationInterface* instance
)
{
// queueMutex must be locked whilst accessing queues
{
// queueMutex must be locked whilst accessing queues
- MessageQueueMutex::
scoped_lock lock( mImpl->queueMutex
);
+ MessageQueueMutex::
ScopedLock lock(mImpl->queueMutex
);
- mImpl->updateWorkingInterfaceQueue.PushBack(
instance
);
+ mImpl->updateWorkingInterfaceQueue.PushBack(
instance
);
}
}
-void NotificationManager::QueueMessage(
MessageBase* message
)
+void NotificationManager::QueueMessage(
MessageBase* message
)
{
{
- DALI_ASSERT_DEBUG(
NULL != message
);
+ DALI_ASSERT_DEBUG(
NULL != message
);
// queueMutex must be locked whilst accessing queues
// queueMutex must be locked whilst accessing queues
- MessageQueueMutex::
scoped_lock lock( mImpl->queueMutex
);
+ MessageQueueMutex::
ScopedLock lock(mImpl->queueMutex
);
- mImpl->updateWorkingMessageQueue.PushBack(
message
);
+ mImpl->updateWorkingMessageQueue.PushBack(
message
);
}
void NotificationManager::UpdateCompleted()
{
// queueMutex must be locked whilst accessing queues
}
void NotificationManager::UpdateCompleted()
{
// queueMutex must be locked whilst accessing queues
- MessageQueueMutex::
scoped_lock lock( mImpl->queueMutex
);
+ MessageQueueMutex::
ScopedLock lock(mImpl->queueMutex
);
// Move messages from update working queue to completed queue
// note that in theory its possible for update completed to have last frames
// events as well still hanging around. we need to keep them as well
// Move messages from update working queue to completed queue
// note that in theory its possible for update completed to have last frames
// events as well still hanging around. we need to keep them as well
- mImpl->updateCompletedMessageQueue.MoveFrom(
mImpl->updateWorkingMessageQueue
);
+ mImpl->updateCompletedMessageQueue.MoveFrom(
mImpl->updateWorkingMessageQueue
);
// move pointers from interface queue
// move pointers from interface queue
- MoveElements(
mImpl->updateWorkingInterfaceQueue, mImpl->updateCompletedInterfaceQueue
);
+ MoveElements(
mImpl->updateWorkingInterfaceQueue, mImpl->updateCompletedInterfaceQueue
);
// finally the lock is released
}
bool NotificationManager::MessagesToProcess()
{
// queueMutex must be locked whilst accessing queues
// finally the lock is released
}
bool NotificationManager::MessagesToProcess()
{
// queueMutex must be locked whilst accessing queues
- MessageQueueMutex::
scoped_lock lock( mImpl->queueMutex
);
+ MessageQueueMutex::
ScopedLock lock(mImpl->queueMutex
);
- return (
0u < mImpl->updateCompletedMessageQueue.Count() ||
-
( 0u < mImpl->updateCompletedInterfaceQueue.Count() )
);
+ return (0u < mImpl->updateCompletedMessageQueue.Count() ||
+
(0u < mImpl->updateCompletedInterfaceQueue.Count())
);
}
void NotificationManager::ProcessMessages()
{
// queueMutex must be locked whilst accessing queues
{
}
void NotificationManager::ProcessMessages()
{
// queueMutex must be locked whilst accessing queues
{
- MessageQueueMutex::
scoped_lock lock( mImpl->queueMutex
);
+ MessageQueueMutex::
ScopedLock lock(mImpl->queueMutex
);
// Move messages from update completed queue to event queue
// note that in theory its possible for event queue to have
// last frames events as well still hanging around so need to keep them
// Move messages from update completed queue to event queue
// note that in theory its possible for event queue to have
// last frames events as well still hanging around so need to keep them
- mImpl->eventMessageQueue.MoveFrom(
mImpl->updateCompletedMessageQueue
);
- MoveElements(
mImpl->updateCompletedInterfaceQueue, mImpl->eventInterfaceQueue
);
+ mImpl->eventMessageQueue.MoveFrom(
mImpl->updateCompletedMessageQueue
);
+ MoveElements(
mImpl->updateCompletedInterfaceQueue, mImpl->eventInterfaceQueue
);
}
// end of scope, lock is released
}
// end of scope, lock is released
- MessageContainer::Iterator iter = mImpl->eventMessageQueue.Begin();
- const MessageContainer::Iterator end = mImpl->eventMessageQueue.End();
-
for( ; iter != end; ++iter
)
+ MessageContainer::Iterator
iter = mImpl->eventMessageQueue.Begin();
+ const MessageContainer::Iterator end
= mImpl->eventMessageQueue.End();
+
if(iter != end
)
{
{
- (*iter)->Process( 0u/*ignored*/ );
+ DALI_TRACE_BEGIN(gTraceFilter, "DALI_NOTIFICATION_PROCESS_MESSAGE");
+ for(; iter != end; ++iter)
+ {
+ (*iter)->Process(0u /*ignored*/);
+ }
+ DALI_TRACE_END(gTraceFilter, "DALI_NOTIFICATION_PROCESS_MESSAGE");
}
// release the processed messages from event side queue
mImpl->eventMessageQueue.Clear();
}
// release the processed messages from event side queue
mImpl->eventMessageQueue.Clear();
- InterfaceContainer::Iterator iter2 = mImpl->eventInterfaceQueue.Begin();
- const InterfaceContainer::Iterator end2 = mImpl->eventInterfaceQueue.End();
-
for( ; iter2 != end2; ++iter2
)
+ InterfaceContainer::Iterator
iter2 = mImpl->eventInterfaceQueue.Begin();
+ const InterfaceContainer::Iterator end2
= mImpl->eventInterfaceQueue.End();
+
if(iter2 != end2
)
{
{
-
CompleteNotificationInterface* interface = *iter2
;
-
if( interface
)
+
DALI_TRACE_BEGIN(gTraceFilter, "DALI_NOTIFICATION_NOTIFY_COMPLETED")
;
+
for(; iter2 != end2; ++iter2
)
{
{
- interface->NotifyCompleted();
+ CompleteNotificationInterface* interface = *iter2;
+ if(interface)
+ {
+ interface->NotifyCompleted();
+ }
}
}
+ DALI_TRACE_END(gTraceFilter, "DALI_NOTIFICATION_NOTIFY_COMPLETED");
}
// just clear the container, we dont own the objects
mImpl->eventInterfaceQueue.Clear();
}
// just clear the container, we dont own the objects
mImpl->eventInterfaceQueue.Clear();