From: sung-su.kim Date: Thu, 8 Aug 2013 07:57:22 +0000 (+0900) Subject: [Release] livebox.web-provider-1.46 X-Git-Tag: submit/tizen_2.2/20130808.075753^0 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fframework%2Fweb%2Fweb-provider.git;a=commitdiff_plain;h=f643ede34758c7f17ad764651ce7461bca776af1 [Release] livebox.web-provider-1.46 Change-Id: I652ba45d397494bc4df75221eaa7cc45d71979d5 --- diff --git a/packaging/livebox.web-provider.spec b/packaging/livebox.web-provider.spec index 2365e64..c9f6c6c 100755 --- a/packaging/livebox.web-provider.spec +++ b/packaging/livebox.web-provider.spec @@ -1,7 +1,7 @@ #git:framework/web/web-provider Name: livebox.web-provider Summary: web framework for livebox -Version: 1.43 +Version: 1.46 Release: 1 Group: main/app License: Flora License, Version 1.1 diff --git a/src/Core/Box.cpp b/src/Core/Box.cpp index 0e46e34..10733a2 100644 --- a/src/Core/Box.cpp +++ b/src/Core/Box.cpp @@ -89,7 +89,6 @@ bool Box::show() RenderInfoPtr renderInfo = makeRenderInfo(renderTypeCreate, URL_TYPE_BOX); m_boxBuffer->stopCanvasUpdate(); m_view->showBox(renderInfo); - ecore_idler_add(startUpdateRenderBufferIdlerCallback, m_boxBuffer.get()); } catch (...) { return false; } @@ -342,7 +341,6 @@ void Box::updateInternal() RenderInfoPtr renderInfo = makeRenderInfo(renderTypeUpdate, URL_TYPE_BOX); m_boxBuffer->stopCanvasUpdate(); m_view->showBox(renderInfo); - ecore_idler_add(startUpdateRenderBufferIdlerCallback, m_boxBuffer.get()); } void Box::setState(IBoxStatePtr state) diff --git a/src/Core/BoxSchemeHandler.cpp b/src/Core/BoxSchemeHandler.cpp index 472d0b5..cbacb14 100755 --- a/src/Core/BoxSchemeHandler.cpp +++ b/src/Core/BoxSchemeHandler.cpp @@ -199,7 +199,7 @@ bool BoxSchemeHandler::handleReload(std::string& instanceId) } // In the future, new content info can be set by caller - box->update(time(NULL), box->m_boxInfo->contentInfo); + box->updateInternal(); return true; } diff --git a/src/Daemon/BoxDaemonImpl.cpp b/src/Daemon/BoxDaemonImpl.cpp index ede2908..11b17eb 100755 --- a/src/Daemon/BoxDaemonImpl.cpp +++ b/src/Daemon/BoxDaemonImpl.cpp @@ -499,28 +499,29 @@ void BoxDaemonImpl::setProviderCallbacks(ProviderCallbacks& callbacks) callbacks.set_period = BoxDaemonImpl::boxPeriodChangeCallback; } -const char* BoxDaemonImpl::getBoxType(const char* boxId) +std::string BoxDaemonImpl::getBoxType(const char* boxId) { LogD("enter"); if (!boxId) { - return NULL; + return std::string(); } const char* type = web_provider_livebox_get_box_type(boxId); - std::string boxType; if (!type) { - std::string serviceBoxId(boxId); - boxType = m_pluginConnector->getBoxType(serviceBoxId); + std::string boxType = m_pluginConnector->getBoxType(boxId); if (boxType.empty()) { LogD("unrecognized box id"); - return NULL; + } else { + LogD("box id: %s, type: %s", boxId, boxType.c_str()); } - type = strdup(boxType.c_str()); + return boxType; } LogD("box id: %s, type: %s", boxId, type); - return type; + std::string result{type}; + free(const_cast(type)); + return result; } BoxInfoPtr BoxDaemonImpl::initializeBoxInfo(ProviderEventArgPtr arg) @@ -536,12 +537,11 @@ BoxInfoPtr BoxDaemonImpl::initializeBoxInfo(ProviderEventArgPtr arg) return BoxInfoPtr(); } - const char* type = getBoxType(arg->pkgname); - if (!type) { + std::string type = getBoxType(arg->pkgname); + if (type.empty()) { return BoxInfoPtr(); } BoxInfoPtr infoPtr = BoxInfoPtr(new BoxInfo(type, arg->pkgname, arg->id)); - delete[] type; return infoPtr; } diff --git a/src/Daemon/BoxDaemonImpl.h b/src/Daemon/BoxDaemonImpl.h index 66c2276..df4a96f 100644 --- a/src/Daemon/BoxDaemonImpl.h +++ b/src/Daemon/BoxDaemonImpl.h @@ -72,7 +72,7 @@ class BoxDaemonImpl { // common private functions void setProviderCallbacks(ProviderCallbacks& callbacks); - const char* getBoxType(const char* boxId); + std::string getBoxType(const char* boxId); BoxInfoPtr initializeBoxInfo(ProviderEventArgPtr arg); // functions for handling appcontrol per operation diff --git a/src/Plugin/AppBoxPlugin/AppBoxManager.cpp b/src/Plugin/AppBoxPlugin/AppBoxManager.cpp index 61672c7..ea71ad1 100644 --- a/src/Plugin/AppBoxPlugin/AppBoxManager.cpp +++ b/src/Plugin/AppBoxPlugin/AppBoxManager.cpp @@ -17,11 +17,14 @@ * @file AppBoxManager.cpp * @author Yunchan Cho (yunchan.cho@samsung.com) */ +#include #include #include #include #include #include +#include +#include #include "AppBoxObserver.h" #include "AppBoxManager.h" @@ -34,8 +37,6 @@ AppBoxManager::AppBoxManager(IBoxPluginFactoryPtr factory) if (!ret) { throw; // throw exeception } - m_defaultEwkContext.reset( - ewk_context_new_with_injected_bundle_path(bundlePath.c_str())); AppBoxObserver::Instance()->initialize(); } @@ -47,12 +48,30 @@ AppBoxManager::~AppBoxManager() bool AppBoxManager::requestAddBox(BoxInfoPtr boxInfo, EwkContextPtr ewkContext) { - ewkContext = getAvailableEwkContext(); + + const char* appId = + web_provider_livebox_get_app_id(boxInfo->boxId.c_str()); + + if (!appId) { + LogD("no appid of %s", boxInfo->boxId.c_str()); + return false; + } + + std::string appIdStr(appId); + delete appId; + + auto it = m_ewkContextMap.find(appIdStr); + if (it == m_ewkContextMap.end()) { + ewkContext = getAvailableEwkContext(); + insertContextMap(appIdStr, ewkContext); + } else { + ewkContext = it->second; + } + if (!BoxManager::requestAddBox(boxInfo, ewkContext)) { return false; } - insertContextMap(ewkContext, boxInfo->instanceId); return true; } @@ -62,26 +81,22 @@ bool AppBoxManager::requestRemoveBox(std::string& instanceId) return false; } - eraseContextMap(instanceId); return true; } EwkContextPtr AppBoxManager::getAvailableEwkContext() { - // TODO make proper Ewk_Context instance, and update context map - // std::shared_ptr context( - // ewk_context_new(), - // BoxManager::deleteDefaultEwkContext); - - return m_defaultEwkContext; + return EwkContextPtr( + ewk_context_new_with_injected_bundle_path(bundlePath.c_str()), + BoxManager::EwkContextDeleter()); } -void AppBoxManager::insertContextMap(EwkContextPtr ewkContext, std::string& instanceId) +void AppBoxManager::insertContextMap(std::string& appId, EwkContextPtr ewkContext) { - // not implemented + m_ewkContextMap.insert(EwkContextMapPair(appId, ewkContext)); } -void AppBoxManager::eraseContextMap(std::string& instanceId) +void AppBoxManager::eraseContextMap(std::string& appId) { - // not implemented + m_ewkContextMap.erase(appId); } diff --git a/src/Plugin/AppBoxPlugin/AppBoxManager.h b/src/Plugin/AppBoxPlugin/AppBoxManager.h index 51d9fcb..150ec50 100644 --- a/src/Plugin/AppBoxPlugin/AppBoxManager.h +++ b/src/Plugin/AppBoxPlugin/AppBoxManager.h @@ -40,14 +40,14 @@ class AppBoxManager: public BoxManager { bool requestRemoveBox(std::string& instanceId); EwkContextPtr getAvailableEwkContext(); - void insertContextMap(EwkContextPtr context, std::string& instanceId); - void eraseContextMap(std::string& instanceId); + void insertContextMap(std::string& appId, EwkContextPtr ewkContext); + void eraseContextMap(std::string& appId); explicit AppBoxManager(IBoxPluginFactoryPtr factory); // members - typedef std::map EwkContextMap; - EwkContextMap m_contextMap; - EwkContextPtr m_defaultEwkContext; + typedef std::map EwkContextMap; + typedef std::pair EwkContextMapPair; + EwkContextMap m_ewkContextMap; }; diff --git a/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp b/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp index a7c3939..ce0fbac 100755 --- a/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp +++ b/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp @@ -71,7 +71,10 @@ AppBoxRenderView::AppBoxRenderView( } m_boxRenderBuffer = AppBoxObserver::Instance()->getRenderBuffer(m_instanceId); - m_pdFastOpen = web_provider_livebox_get_pd_fast_open(m_boxId.c_str()) ? true : false; + + // use fastopen to default + // m_pdFastOpen = web_provider_livebox_get_pd_fast_open(m_boxId.c_str()) ? true : false; + m_pdFastOpen = false; AppBoxObserver::Instance()->registerRenderView(m_instanceId, this); } diff --git a/src/Plugin/BoxPluginConnector.cpp b/src/Plugin/BoxPluginConnector.cpp index 90fce64..cc3e58a 100644 --- a/src/Plugin/BoxPluginConnector.cpp +++ b/src/Plugin/BoxPluginConnector.cpp @@ -164,7 +164,7 @@ bool BoxPluginConnector::requestCommand( return true; } -std::string BoxPluginConnector::getBoxType(std::string& serviceBoxId) +std::string BoxPluginConnector::getBoxType(const std::string& serviceBoxId) { LogD("enter"); diff --git a/src/Plugin/BoxPluginConnector.h b/src/Plugin/BoxPluginConnector.h index f9744b9..5ada8db 100644 --- a/src/Plugin/BoxPluginConnector.h +++ b/src/Plugin/BoxPluginConnector.h @@ -35,7 +35,7 @@ class BoxPluginConnector: public IBoxPluginConnector { virtual bool shutdown(); virtual bool requestCommand( const request_cmd_type type, const BoxInfoPtr& boxInfo); - virtual std::string getBoxType(std::string& serviceBoxId); + virtual std::string getBoxType(const std::string& serviceBoxId); virtual ~BoxPluginConnector(); private: diff --git a/src/Plugin/IBoxPluginConnector.h b/src/Plugin/IBoxPluginConnector.h index 7b954e0..3e94fb8 100644 --- a/src/Plugin/IBoxPluginConnector.h +++ b/src/Plugin/IBoxPluginConnector.h @@ -31,7 +31,7 @@ class IBoxPluginConnector: Noncopyable { virtual bool shutdown() = 0; virtual bool requestCommand( const request_cmd_type type, const BoxInfoPtr& boxInfo) = 0; - virtual std::string getBoxType(std::string& serviceBoxId) = 0; + virtual std::string getBoxType(const std::string& serviceBoxId) = 0; virtual ~IBoxPluginConnector() {}; };