Performance improvement of PluginManager with clean up some plugin code.
[framework/web/wrt-plugins-common.git] / src / plugin-loading / explorer.cpp
index 1ecad15..3b385f6 100644 (file)
@@ -28,7 +28,6 @@
 #include "plugin_property_support.h"
 
 // JS overlay
-#include <js_overlay_support.h>
 #include <js_overlay_types.h>
 
 namespace {
@@ -51,7 +50,6 @@ Explorer::Explorer(JSGlobalContextRef context) :
     m_globalObject =
         JavaScriptInterfaceSingleton::Instance().getGlobalObject(context);
 
-    LogDebug("Register main frame");
     //register main frame;
     m_iframeSupport.registerIframe(m_globalObject);
 
@@ -65,7 +63,6 @@ Explorer::~Explorer()
 JSObjectPtr Explorer::getJSObjectProperty(const std::string& propertyName,
                                           JSObjectPtr object)
 {
-    LogDebug("Get object property " << propertyName);
     return JavaScriptInterfaceSingleton::Instance().getJSObjectProperty(
                m_context, object, propertyName);
 }
@@ -111,15 +108,11 @@ JSObjectPtr Explorer::getProperty(
 bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
                               JSGlobalContextRef context)
 {
-    LogDebug("Register to global object");
-
     bool retValue;
 
     if (declaration->getParentName() == GLOBAL_OBJECT_NAME) {
-        LogDebug("Connect to Global object");
         retValue = register_(declaration, m_globalObject, context);
     } else { //PIM support
-        LogDebug("Connect to NOT global object");
         //it should be master object name
         string masterName = declaration->getParentName();
         auto pos = masterName.find(".");
@@ -138,13 +131,10 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
     }
 
     if (declaration->checkIframesSupported()) {
-        LogDebug("Iframe supported");
         m_iframeSupport.registerDeclaration(declaration);
         //        m_iframeSupport.invokeCallbackForMainFrame(m_context,
         //                                                   declaration,
         //                                                   newObject);
-    } else {
-        LogDebug("Iframe NOT supported");
     }
 
     return retValue;
@@ -155,19 +145,16 @@ bool Explorer::registerObject(const JSObjectDeclarationPtr& declaration,
                               JSObjectPtr providedObject,
                               JSGlobalContextRef context)
 {
-    LogDebug(
-        "Register object. Provided object name: '" << providedObjectName
-                                                   <<
-        "', registration of: '" << declaration->getName() << "'");
+    LogDebug("'" << providedObjectName << "' <- '" << declaration->getName() << "'");
 
     std::string fullParentName = declaration->getParentName();
-    LogDebug("Parent name: " << declaration->getParentName());
 
     if (fullParentName == providedObjectName) {
-        LogDebug("Provided object match equaly to requested parent");
         return register_(declaration, providedObject, context);
     }
 
+    LogDebug("Provided object was not matched!!");
+
     //check if object exists in fullParentName
     auto pos = fullParentName.find(providedObjectName);
     if (pos == string::npos) {
@@ -219,43 +206,14 @@ bool Explorer::register_(const JSObjectDeclarationPtr& declaration,
     typedef JSObjectDeclaration::Options JO;
 
     JSGlobalContextRef gContext = (context == NULL) ? m_context : context;
-    JSObjectPtr newObject;
-
     JSObjectPtr objectInstance = JavaScriptInterfaceSingleton::Instance().
             createObject(gContext, declaration);
 
-    //function creation
-    if (declaration->getOptions() &&
-        declaration->getOptions()->getType() == JO::ClassType::Function)
-    {
-        LogDebug("Loading function object " << declaration->getName());
-
-        auto type = declaration->getOptions()->getIframeOverlay();
-        if (JO::IFrameOverlay::OverlayedBeforeOriginal == type) {
-            LogDebug("Create overlayed function");
-            JSObjectPtr original =
-                JavaScriptInterfaceSingleton::Instance().
-                    getJSObjectProperty(gContext,
-                                        parent,
-                                        declaration->getName());
-            newObject = JSOverlaySupport::
-                    createWrappedFunction(gContext,
-                                          original,
-                                          objectInstance,
-                                          declaration->getName());
-        } else {
-            LogDebug("create normal function");
-            newObject = objectInstance;
-        }
-    } else { //object creation
-        newObject = objectInstance;
-    }
-
     JavaScriptInterfaceSingleton::Instance().setObjectProperty(
         gContext,
         parent,
         declaration->getName(),
-        newObject);
+        objectInstance);
 
     //notice
     if (declaration->getOptions() &&
@@ -369,7 +327,7 @@ void Explorer::cleanIframesData()
     m_iframeSupport.clean();
 }
 
-void Explorer::callEventListeners(CustomEventType eventType, void* data)
+void Explorer::callEventListeners(CustomEventType /*eventType*/, void* /*data*/)
 {
 #if 0 // deprecated
     using namespace WrtPlugins::Tizen;