Update change log and spec for wrt-plugins-tizen_0.4.70
[platform/framework/web/wrt-plugins-tizen.git] / src / Filesystem / plugin_initializer.cpp
old mode 100755 (executable)
new mode 100644 (file)
index dbbc5a4..fc64952
 // limitations under the License.
 //
 
-
-#include <dpl/log/log.h>
 #include <Commons/WrtAccess/WrtAccess.h>
 #include <Commons/plugin_initializer_def.h>
+#include <TimeTracer.h>
+#include <Security.h>
 #include "JSFilesystemManager.h"
 #include "JSFile.h"
 #include "JSFilestream.h"
 #include "FilesystemAsyncCallbackManager.h"
 #include "FilesystemListenerManager.h"
+#include "plugin_config.h"
+
+#include <Logger.h>
 
 using namespace WrtDeviceApis;
 using namespace WrtDeviceApis::Commons;
 
+namespace DeviceAPI {
+namespace Filesystem {
+
+AceSecurityStatus filesystemAceCheckAccessFunction(const char* functionName)
+{      
+       return FILESYSTEM_CHECK_ACCESS(functionName);
+}
+
+DEFINE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);    
+
+DEFINE_SECURITY_ACCESSOR_SETTER(AceCheckerFilesystemSetter, JSFilesystemManager::PrivateObject, gSecurityAccessor);    
+DEFINE_JSOBJECT_SECURITY_ACCESSOR_SETTER(AceCheckerFilesystemConstructorSetter, gSecurityAccessor);
+
+class_definition_options_t FilesystemOptions =
+{      
+    JS_CLASS,  
+    CREATE_INSTANCE,   
+    ALWAYS_NOTICE,     
+    USE_OVERLAYED, //ignored   
+    AceCheckerFilesystemSetter,        
+    NULL       
+};     
+
 void on_widget_start_callback(int widgetId)
 {
+       TIME_TRACER_INIT();
        Try {
         WrtAccessSingleton::Instance().initialize(widgetId);
        } Catch (Commons::Exception) {
-               LogError("WrtAccess initialization failed");
+               LoggerE("WrtAccess initialization failed");
        }
+       INITAILIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor, filesystemAceCheckAccessFunction);
 }
 
 void on_widget_stop_callback(int widgetId)
 {
+       TIME_TRACER_EXPORT_REPORT_TO(TIME_TRACER_EXPORT_FILE,"FileSystem");
+       TIME_TRACER_RELEASE();
        Try {
         WrtAccessSingleton::Instance().deinitialize(widgetId);
        } Catch (Commons::Exception) {
-               LogError("WrtAccess deinitialization failed");
+               LoggerE("WrtAccess deinitialization failed");
        }
+       FINALIZE_GLOBAL_SECURITY_ACCESSOR(gSecurityAccessor);
 }
 
 void on_frame_unload_callback(const void * context)
 {
-       LogDebug("[Tizen\\filesystem] on_frame_unload_callback (" << context << ")");
+       LoggerD("[Tizen\\filesystem] on_frame_unload_callback (" << context << ")");
        DeviceAPI::Filesystem::FilesystemAsyncCallbackManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
        DeviceAPI::Filesystem::FilesystemListenerManagerSingleton::Instance().unregisterContext(static_cast<JSContextRef>(context));
 }
 
 void on_frame_load_callback(const void * context)
 {
-       LogDebug("[Tizen\\filesystem] on_frame_load_callback (" << context << ")");
+       LoggerD("[Tizen\\filesystem] on_frame_load_callback (" << context << ")");
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)
@@ -69,8 +100,10 @@ PLUGIN_CLASS_MAP_BEGIN
 PLUGIN_CLASS_MAP_ADD_CLASS(WRT_JS_EXTENSION_OBJECT_TIZEN,
         "filesystem",
         (js_class_template_getter)DeviceAPI::Filesystem::JSFilesystemManager::getClassRef,
-        NULL)
+        &FilesystemOptions)
 PLUGIN_CLASS_MAP_END
 
 #undef FILESYSTEM
 
+} // Filesystem
+} // DeviceAPI