add patch
[framework/osp/web.git] / src / controls / FWebCtrlWebStorageManager.cpp
index d49eb6e..518f66e 100755 (executable)
@@ -21,6 +21,7 @@
  *
  * The file contains the definition of FWebCtrlWebStorageManager class.
  */
+#include <pthread.h>
 #include <unique_ptr.h>
 #include <FBaseColIList.h>
 #include <FBaseSysLog.h>
@@ -44,8 +45,6 @@ WebStorageManager* WebStorageManager::__pInstance = null;
 WebStorageManager::WebStorageManager(void)
        : __pWebStorageManagerImpl(null)
 {
-       result r = E_SUCCESS;
-
        std::unique_ptr<_WebStorageManagerImpl> pWebStorageManagerImpl(new (std::nothrow) _WebStorageManagerImpl());
        SysTryReturnVoidResult(NID_WEB_CTRL, pWebStorageManagerImpl.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
@@ -55,6 +54,8 @@ WebStorageManager::WebStorageManager(void)
 
 WebStorageManager::~WebStorageManager(void)
 {
+       delete __pWebStorageManagerImpl;
+       __pWebStorageManagerImpl = null;
 }
 
 
@@ -103,7 +104,7 @@ WebStorageManager::GetOriginListN(WebStorageType storageType) const
 
        ClearLastResult();
        result r = E_SUCCESS;
-       
+
        r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
 
@@ -119,7 +120,6 @@ WebStorageManager::SetQuotaForOrigin(WebStorageType storageType, const String& o
 {
        SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       ClearLastResult();
        result r = E_SUCCESS;
 
        r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
@@ -128,7 +128,7 @@ WebStorageManager::SetQuotaForOrigin(WebStorageType storageType, const String& o
        r = __pWebStorageManagerImpl->SetQuotaForOrigin(storageType, origin, quota);
        SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       return r;
+       return E_SUCCESS;
 }
 
 
@@ -145,7 +145,7 @@ WebStorageManager::GetQuotaForOrigin(WebStorageType storageType, const String& o
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
 
        quota = __pWebStorageManagerImpl->GetQuotaForOrigin(storageType, origin);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        return quota;
 }
@@ -164,7 +164,7 @@ WebStorageManager::GetUsageForOrigin(WebStorageType storageType, const String& o
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, E_PRIVILEGE_DENIED, "[%s] The application does not have the privilege to call this method.", GetErrorMessage(E_PRIVILEGE_DENIED));
 
        usage = __pWebStorageManagerImpl->GetQuotaForOrigin(storageType, origin);
-       SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       SysTryReturn(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, 0, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
        return usage;
 }
@@ -175,7 +175,6 @@ WebStorageManager::Remove(WebStorageType storageType, const String& origin)
 {
        SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       ClearLastResult();
        result r = E_SUCCESS;
 
        r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
@@ -184,7 +183,7 @@ WebStorageManager::Remove(WebStorageType storageType, const String& origin)
        r = __pWebStorageManagerImpl->Remove(storageType, origin);
        SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       return r;
+       return E_SUCCESS;
 }
 
 
@@ -193,7 +192,6 @@ WebStorageManager::RemoveAll(WebStorageType storageType)
 {
        SysAssertf(__pWebStorageManagerImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       ClearLastResult();
        result r = E_SUCCESS;
 
        r = _AccessController::CheckUserPrivilege(_PRV_WEB_PRIVACY);
@@ -202,8 +200,8 @@ WebStorageManager::RemoveAll(WebStorageType storageType)
        r = __pWebStorageManagerImpl->RemoveAll(storageType);
        SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       return r;
+       return E_SUCCESS;
 }
 
 
-}}} // Tizen::Web::Controls
\ No newline at end of file
+}}} // Tizen::Web::Controls