#include <dpl/assert.h>
#include <dpl/scoped_array.h>
-#include <dpl/log/log.h>
+#include <dpl/log/secure_log.h>
#include <dpl/foreach.h>
#include <dpl/singleton_impl.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#define PLUGIN_LOGIC_SANITY_CHECK \
if (!s_sanityCheck) \
{ \
- LogError("Object is not available. Wrong flow occured"); \
+ _E("Object is not available. Wrong flow occured"); \
return; \
}
s_sanityCheck = true;
DPL::Log::LogSystemSingleton::Instance().SetTag("WRT_PLUGINS");
- LogDebug("Initializing Plugin Logic...");
+ _D("Initializing Plugin Logic...");
m_pluginsSupport = PluginContainerSupportPtr(new PluginContainerSupport());
// explicit call to keep singleton's lifetime until calling destructor.
PluginLogic::Impl::~Impl()
{
- LogDebug("");
+ _D("called");
s_sanityCheck = false;
FOREACH(it, m_sessions)
{
- LogError("Must stop widget session before exit!");
+ _W("Must stop widget session before exit!");
it->second->stopSession();
}
-
- LogDebug("Deinitializing plugin Logic...");
}
void PluginLogic::initSession(int widgetHandle)
void PluginLogic::performLibrariesUnload()
{
- LogError("Libraries unload TURNED OFF");
+ _W("This function is DEPRECATED");
// m_impl->performLibrariesUnload();
}
void PluginLogic::loadPluginsIntoIframes(JSGlobalContextRef /*context*/)
{
- LogError("This function is Deprecated");
+ _W("This function is DEPRECATED");
}
void PluginLogic::setCustomProperties(double /*scaleFactor*/,
const char* /*encodedBundle*/,
const char* /*theme*/)
{
- LogError("This function is DEPRECATED");
+ _W("This function is DEPRECATED");
}
void PluginLogic::setCustomProperties(JSGlobalContextRef context,
void PluginLogic::dispatchJavaScriptEvent(CustomEventType /*eventType*/)
{
- LogError("This function is DEPRECATED");
+ _W("This function is DEPRECATED");
}
void PluginLogic::dispatchJavaScriptEvent(JSGlobalContextRef context,
void PluginLogic::Impl::initSession(int widgetHandle)
{
- LogInfo("init pluginLogic...");
+ _D(">---------------------[init session START]---------------------<");
m_pluginsSupport->Initialize(widgetHandle);
+ PluginContainerSupport::PluginsList rootPluginList =
+ m_pluginsSupport->getRootPlugins();
- //add standard objects
- LogDebug("Preload plugins so file");
-
- PluginContainerSupport::PluginsList pluginList =
- m_pluginsSupport->getPluginsList();
-
- FOREACH(it, pluginList)
+ FOREACH(it, rootPluginList)
{
PluginModelPtr& pluginModel = *it;
-
- if (!pluginModel->LibraryDependencies.Get()->empty()) {
- // Only Root Object
- continue;
- }
-
PluginPtr pluginLib = pluginModel->LibraryInstance.Get();
if (!pluginLib) {
pluginLib = Plugin::LoadFromFile(path);
if (!pluginLib) {
- LogError("Loading library failed");
+ _W("Loading library failed");
} else {
pluginModel->LibraryInstance.Set(pluginLib);
-
- LogDebug(
- "pluginModel->LibraryInstance.Set() : " <<
- pluginLib->GetFileName());
+ _D("pluginModel->LibraryInstance.Set() : %s",
+ pluginLib->GetFileName().c_str());
}
} else {
- LogDebug("Already loaded");
+ _D("Already loaded");
}
}
-
- LogDebug("Preload plugins so file_done");
+ _D("========== init session END ==========");
}
void PluginLogic::Impl::startSession(int widgetHandle,
const char* encodedBundle,
const char* theme)
{
- LogInfo("Starting widget session...");
+ _D("========== start session START ==========");
if (!m_pluginsSupport->isInitialized()) {
m_pluginsSupport->Initialize(widgetHandle);
// Check if corresponding session if not already created
if (sessionIt != m_sessions.end()) {
- LogWarning("Session already started!");
- return;
+ _W("Session already started!");
+ } else {
+ auto newSession = JSPageSessionPtr(new JSPageSession(m_pluginsSupport));
+ newSession->startSession(widgetHandle,
+ context,
+ scaleFactor,
+ encodedBundle,
+ theme);
+
+ m_sessions[context] = newSession;
}
-
- auto newSession = JSPageSessionPtr(new JSPageSession(m_pluginsSupport));
- newSession->startSession(widgetHandle,
- context,
- scaleFactor,
- encodedBundle,
- theme);
-
- m_sessions[context] = newSession;
+ _D("========== start session END ==========");
}
void PluginLogic::Impl::stopSession(JSGlobalContextRef context)
{
- LogInfo("Stopping widget session...");
+ _D("========== stop session START ==========");
auto sessionIt = m_sessions.find(context);
if (sessionIt == m_sessions.end()) {
- LogError("Session not exist!");
- return;
+ _W("Session not exist!");
+ } else {
+ sessionIt->second->stopSession();
+ m_sessions.erase(sessionIt);
}
-
- sessionIt->second->stopSession();
- m_sessions.erase(sessionIt);
-
- LogInfo("Widget session stopped.");
+ _D("========== stop session END ==========");
}
bool PluginLogic::Impl::loadPluginOnDemand(
JSGlobalContextRef context
)
{
- LogInfo("Load plugin on demand");
+ _D("========== load ondemand plugin ==========");
auto sessionIt = m_sessions.find(context);
if (sessionIt == m_sessions.end()) {
- LogWarning("Session not exist!");
+ _W("Session not exist!");
return false;
}
void PluginLogic::Impl::loadFrame(JSGlobalContextRef context)
{
- LogDebug("Load a frame");
-
+ _D("========== load frame START ==========");
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
if (sessionIt == m_sessions.end()) {
- LogWarning("Session not exist!");
- return;
+ _W("Session not exist!");
+ } else {
+ sessionIt->second->loadFrame(context);
}
-
- sessionIt->second->loadFrame(context);
+ _D("========== load frame END ==========");
}
void PluginLogic::Impl::unloadFrame(JSGlobalContextRef context)
{
- LogDebug("Unload a frame");
-
+ _D("========== unload frame START ==========");
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
if (sessionIt == m_sessions.end()) {
LogWarning("Session not exist!");
- return;
- }
+ } else {
+ sessionIt->second->unloadFrame(context);
- sessionIt->second->unloadFrame(context);
-
- // I don't know why this session should be removed here.
- // session list is removed also from stopSession().
- //m_sessions.erase(sessionIt);
+ // I don't know why this session should be removed here.
+ // session list is removed also from stopSession().
+ //m_sessions.erase(sessionIt);
+ }
+ _D("========== unload frame END ==========");
}
void PluginLogic::Impl::setCustomProperties(JSGlobalContextRef context,
const char* encodedBundle,
const char* theme)
{
- LogInfo(
- "set properties of window object " << scaleFactor << ", "
- << encodedBundle << ", " <<
- theme);
-
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
if (sessionIt == m_sessions.end()) {
- LogWarning("Session not exist!");
+ _W("Session not exist!");
return;
}
CustomEventType eventType,
void* data)
{
- LogDebug("Dispatch event");
-
PLUGIN_LOGIC_SANITY_CHECK
auto sessionIt = m_sessions.find(context);
if (sessionIt == m_sessions.end()) {
- LogWarning("Session not exist!");
+ _W("Session not exist!");
return;
}
unsigned int PluginLogic::Impl::windowHandle() const
{
- if (!s_sanityCheck)
- {
+ if (!s_sanityCheck) {
LogError("Object is not available. Wrong flow occured");
}
return m_windowHandle;
void PluginLogic::Impl::setWindowHandle(unsigned int handle)
{
PLUGIN_LOGIC_SANITY_CHECK
- LogDebug("XWindow handle " << handle);
m_windowHandle = handle;
}