#include <map>
#include <JavaScriptCore/JavaScript.h>
-#include <dpl/log/log.h>
#include <dpl/shared_ptr.h>
+#include "Logger.h"
namespace DeviceAPI {
namespace Common {
virtual void protectObject()
{
- LogDebug("Protect object:" << m_object);
+ LoggerD("Protect object:" << m_object);
JSValueProtect(m_context, m_object);
}
virtual void unprotectObject()
{
- LogDebug("Unprotect object:" << m_object);
+ LoggerD("Unprotect object:" << m_object);
JSValueUnprotect(m_context, m_object);
}
virtual void cancelListener()
{
- LogWarning("IListenerItem MUST be used as an inherited shape.");
- LogWarning("If this log has been printed, it must be used with wrong usage.");
+ LoggerW("IListenerItem MUST be used as an inherited shape.");
+ LoggerW("If this log has been printed, it must be used with wrong usage.");
}
virtual bool equal(const DeviceAPI::Common::IListenerItemPtr &other) const
virtual void registerListener(IListenerItemPtr &canceller, const JSContextRef context)
{
- LogDebug("Registering a listener on context:" << context);
+ LoggerD("Registering a listener on context:" << context);
canceller->protectObject();
m_map.insert(ListenerPair(context, canceller));
virtual void unregisterContext(const JSContextRef context)
{
- LogDebug("Unregistering all listeners on context:" << context);
+ LoggerD("Unregistering all listeners on context:" << context);
ListenerMapIterPair iterPair = m_map.equal_range(context);
for(ListenerMapIter i=iterPair.first; i!=iterPair.second; i++)
{
- LogDebug("Unregistering a listener");
+ LoggerD("Unregistering a listener");
i->second->cancelListener();
i->second->unprotectObject();
}
virtual void unregisterListener(const IListenerItemPtr &canceller)
{
- LogDebug("Unregistering a listener");
+ LoggerD("Unregistering a listener");
for(ListenerMapIter i=m_map.begin(); i!=m_map.end(); i++)
{
if(i->second->equal(canceller))
{
- LogDebug("Found object");
+ LoggerD("Found object");
i->second->unprotectObject();
m_map.erase(i);