summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYunchan Cho <yunchan.cho@samsung.com>2013-04-30 11:46:02 +0900
committerYunchan Cho <yunchan.cho@samsung.com>2013-05-01 11:42:53 +0900
commit18a69b0276eabf09c50782793ea0ef7c53ba666c (patch)
tree7456abb4fc4dd36b59bdb7f7226e0587d33eb663
parent6e91acb87436b0e4a92188ddddf110e069435b09 (diff)
downloadweb-provider-18a69b0276eabf09c50782793ea0ef7c53ba666c.tar.gz
web-provider-18a69b0276eabf09c50782793ea0ef7c53ba666c.tar.bz2
web-provider-18a69b0276eabf09c50782793ea0ef7c53ba666c.zip
[Release] livebox.web-provider-1.18
Change-Id: Ifc793d9b8fa33431b32bb8d1950d54d49bb22b53
-rw-r--r--packaging/livebox.web-provider.spec8
-rw-r--r--src/Core/Box.cpp15
-rw-r--r--src/Core/Box.h4
-rw-r--r--src/Core/BoxManager.cpp26
-rw-r--r--src/Core/BoxManager.h2
-rw-r--r--src/Core/IBox.h5
-rw-r--r--src/Daemon/BoxDaemonImpl.cpp34
-rw-r--r--src/Daemon/BoxDaemonImpl.h6
-rw-r--r--src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp8
-rw-r--r--src/Plugin/AppBoxPlugin/AppBoxRenderView.h1
-rw-r--r--src/Plugin/box_plugin_interface.h1
11 files changed, 87 insertions, 23 deletions
diff --git a/packaging/livebox.web-provider.spec b/packaging/livebox.web-provider.spec
index b0e52ed..3514836 100644
--- a/packaging/livebox.web-provider.spec
+++ b/packaging/livebox.web-provider.spec
@@ -1,6 +1,6 @@
Name: livebox.web-provider
Summary: web framework for livebox
-Version: 1.17
+Version: 1.18
Release: 1
Group: main/app
License: Flora License, Version 1.1
@@ -56,17 +56,20 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror -fno-builtin-malloc" make %{?jobs:-j%jo
%install
rm -rf %{buildroot}
%make_install
+%define app_data /opt/usr/apps/livebox.web-provider/data
+mkdir -p %{buildroot}%{app_data}
%post
killall -9 web-provider
echo "create web livebox DB..."
/usr/bin/web_provider_reset_db.sh
-
if [ -f /usr/lib/rpm-plugins/msm.so ]; then
echo "smack setting..."
chsmack -a 'livebox.web-provider::db' /opt/dbspace/.web_provider.db
chsmack -a 'livebox.web-provider::db' /opt/dbspace/.web_provider.db-journal
fi
+chown 5000:5000 %{app_data}
+chmod 755 %{app_data}
%files -n livebox.web-provider
%manifest livebox.web-provider.manifest
@@ -78,6 +81,7 @@ fi
%attr(755,root,root) %{_bindir}/web_provider_reset_db.sh
%{_prefix}/apps/livebox.web-provider/bin/web-provider
%{_datarootdir}/packages/livebox.web-provider.xml
+%dir %{app_data}
%files devel
%defattr(-,root,root,-)
diff --git a/src/Core/Box.cpp b/src/Core/Box.cpp
index 190a903..2e51dab 100644
--- a/src/Core/Box.cpp
+++ b/src/Core/Box.cpp
@@ -39,6 +39,7 @@ static const std::string renderTypeUpdate("update");
Box::Box(BoxInfoPtr boxInfo, IBoxPluginFactoryPtr factory, EwkContextPtr ewkContext)
: m_boxInfo(boxInfo)
, m_factory(factory)
+ , m_currentTab(true)
{
LogD("enter");
try {
@@ -138,6 +139,7 @@ bool Box::resume()
CHECK_BOX_STATE(m_state, permitResume);
try {
+ m_currentTab = true;
m_updateTimer->start();
m_view->resumeBox();
} catch (...) {
@@ -148,12 +150,15 @@ bool Box::resume()
return true;
}
-bool Box::pause()
+bool Box::pause(bool background)
{
LogD("enter");
CHECK_BOX_STATE(m_state, permitPause);
try {
+ if (!background) {
+ m_currentTab = false;
+ }
m_updateTimer->stop();
m_view->pauseBox();
} catch (...) {
@@ -214,6 +219,9 @@ bool Box::update()
{
LogD("enter");
+ if (!m_currentTab) {
+ return false;
+ }
// reload box
m_boxBuffer->startCanvasUpdate();
RenderInfoPtr renderInfo = makeRenderInfo(renderTypeUpdate);
@@ -233,6 +241,11 @@ bool Box::changePeriod(float period)
return true;
}
+bool Box::isCurrentTab()
+{
+ return m_currentTab;
+}
+
RenderInfoPtr Box::makeRenderInfo(const std::string& renderType) const
{
LogD("enter");
diff --git a/src/Core/Box.h b/src/Core/Box.h
index 12e1418..0ab2f18 100644
--- a/src/Core/Box.h
+++ b/src/Core/Box.h
@@ -46,11 +46,12 @@ class Box: public IBox, public IBoxContext {
bool hide();
bool resize(int width, int height);
bool resume();
- bool pause();
+ bool pause(bool background);
bool openPd(int width, int height, double x, double y);
bool closePd();
bool update();
bool changePeriod(float period);
+ bool isCurrentTab();
~Box();
private:
@@ -74,6 +75,7 @@ class Box: public IBox, public IBoxContext {
IRenderBufferPtr m_pdBuffer;
IRenderViewPtr m_view;
ITimerPtr m_updateTimer;
+ bool m_currentTab;
//IBoxStatePtr m_state;
friend class BoxSchemeHandler;
diff --git a/src/Core/BoxManager.cpp b/src/Core/BoxManager.cpp
index 1b95d61..28efcca 100644
--- a/src/Core/BoxManager.cpp
+++ b/src/Core/BoxManager.cpp
@@ -75,6 +75,9 @@ bool BoxManager::doCommand(const request_cmd_type type, const BoxInfoPtr& boxInf
case REQUEST_CMD_CHANGE_PERIOD:
result = requestChangePeriod(boxInfo->instanceId, boxInfo->period);
break;
+ case REQUEST_CMD_UPDATE_BOX:
+ result = requestUpdateBox(boxInfo->instanceId);
+ break;
default:
LogD("not available request type");
break;
@@ -156,14 +159,17 @@ bool BoxManager::requestPauseBox(std::string& instanceId)
return false;
}
- return box->pause();
+ // paused by switching other page
+ return box->pause(false);
}
bool BoxManager::requestResumeAll()
{
LogD("enter");
for (auto it = m_boxMap.begin(); it != m_boxMap.end(); it++) {
- it->second->resume();
+ if (it->second->isCurrentTab()) {
+ it->second->resume();
+ }
}
return true;
@@ -173,7 +179,10 @@ bool BoxManager::requestPauseAll()
{
LogD("enter");
for (auto it = m_boxMap.begin(); it != m_boxMap.end(); it++) {
- it->second->pause();
+ if (it->second->isCurrentTab()) {
+ // paused by entering background
+ it->second->pause(true);
+ }
}
return true;
@@ -214,6 +223,17 @@ bool BoxManager::requestChangePeriod(std::string& instanceId, float period)
return box->changePeriod(period);
}
+bool BoxManager::requestUpdateBox(std::string& instanceId)
+{
+ LogD("enter");
+ IBoxPtr box = searchBoxMap(instanceId);
+ if (!box) {
+ return false;
+ }
+
+ return box->update();
+}
+
void BoxManager::insertBoxMap(std::string& instanceId, IBoxPtr box)
{
if (!searchBoxMap(instanceId)) {
diff --git a/src/Core/BoxManager.h b/src/Core/BoxManager.h
index ea06e9c..b785037 100644
--- a/src/Core/BoxManager.h
+++ b/src/Core/BoxManager.h
@@ -53,6 +53,8 @@ class EXPORT_CLASS BoxManager: public IBoxManager {
int width, int height, double x, double y);
virtual bool requestClosePd(std::string& instanceId);
virtual bool requestChangePeriod(std::string& instanceId, float period);
+ virtual bool requestUpdateBox(std::string& instanceId);
+
// ewk context deleter
struct EwkContextDeleter {
void operator()(Ewk_Context* ptr);
diff --git a/src/Core/IBox.h b/src/Core/IBox.h
index 5feee10..4452f9d 100644
--- a/src/Core/IBox.h
+++ b/src/Core/IBox.h
@@ -30,13 +30,12 @@ class IBox {
virtual bool hide() = 0;
virtual bool resize(int width, int height) = 0;
virtual bool resume() = 0;
- virtual bool pause() = 0;
+ virtual bool pause(bool background) = 0;
virtual bool openPd(int width, int height, double x, double y) = 0;
virtual bool closePd() = 0;
virtual bool update() = 0;
-
- // functions for specific service
virtual bool changePeriod(float period) = 0;
+ virtual bool isCurrentTab() = 0;
//virtual IBox& operator=(const IBox& rhs) = 0;
//virtual bool operator==(const IBox& rhs) const = 0;
diff --git a/src/Daemon/BoxDaemonImpl.cpp b/src/Daemon/BoxDaemonImpl.cpp
index 9d0083f..47dda06 100644
--- a/src/Daemon/BoxDaemonImpl.cpp
+++ b/src/Daemon/BoxDaemonImpl.cpp
@@ -289,7 +289,7 @@ int BoxDaemonImpl::clickedCallback(ProviderEventArgPtr arg, void* data)
return 0;
}
-int BoxDaemonImpl::resizeCallback(ProviderEventArgPtr arg, void* data)
+int BoxDaemonImpl::boxResizeCallback(ProviderEventArgPtr arg, void* data)
{
LogD("enter");
@@ -395,30 +395,44 @@ int BoxDaemonImpl::resumeCallback(ProviderEventArgPtr arg, void* data)
return ret ? 0 : -1;
}
-int BoxDaemonImpl::updateContentCallback(ProviderEventArgPtr arg, void* data)
+int BoxDaemonImpl::boxPeriodChangeCallback(ProviderEventArgPtr arg, void* data)
{
LogD("enter");
+ BoxDaemonImpl* This = static_cast<BoxDaemonImpl*>(data);
+ BoxInfoPtr info = This->initializeBoxInfo(arg);
+ if (!info) {
+ return -1;
+ }
+ info->period = arg->info.set_period.period;
- return 0;
+ LogD("--------------------------------------------");
+ LogD("boxId: %s", info->boxId.c_str());
+ LogD("InstanceId: %s", info->instanceId.c_str());
+ LogD("period: %f", info->period);
+ LogD("--------------------------------------------");
+
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_CHANGE_PERIOD, info, This);
+ Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
+
+ return ret ? 0 : -1;
}
-int BoxDaemonImpl::changePeriodCallback(ProviderEventArgPtr arg, void* data)
+int BoxDaemonImpl::boxUpdateCallback(ProviderEventArgPtr arg, void* data)
{
LogD("enter");
+
BoxDaemonImpl* This = static_cast<BoxDaemonImpl*>(data);
BoxInfoPtr info = This->initializeBoxInfo(arg);
if (!info) {
return -1;
}
- info->period = arg->info.set_period.period;
LogD("--------------------------------------------");
LogD("boxId: %s", info->boxId.c_str());
LogD("InstanceId: %s", info->instanceId.c_str());
- LogD("period: %f", info->period);
LogD("--------------------------------------------");
- JobInfo* jobInfo = new JobInfo(REQUEST_CMD_CHANGE_PERIOD, info, This);
+ JobInfo* jobInfo = new JobInfo(REQUEST_CMD_UPDATE_BOX, info, This);
Ecore_Job* ret = ecore_job_add(requestBoxJobCallback, jobInfo);
return ret ? 0 : -1;
@@ -441,9 +455,9 @@ void BoxDaemonImpl::setProviderCallbacks(ProviderCallbacks& callbacks)
callbacks.pd_create = BoxDaemonImpl::pdCreateCallback;
callbacks.pd_destroy = BoxDaemonImpl::pdDestroyCallback;
callbacks.clicked = BoxDaemonImpl::clickedCallback;
- callbacks.resize = BoxDaemonImpl::resizeCallback;
- callbacks.update_content = BoxDaemonImpl::updateContentCallback;
- callbacks.set_period = BoxDaemonImpl::changePeriodCallback;
+ callbacks.resize = BoxDaemonImpl::boxResizeCallback;
+ callbacks.update_content = BoxDaemonImpl::boxUpdateCallback;
+ callbacks.set_period = BoxDaemonImpl::boxPeriodChangeCallback;
}
const char* BoxDaemonImpl::getBoxType(const char* boxId)
diff --git a/src/Daemon/BoxDaemonImpl.h b/src/Daemon/BoxDaemonImpl.h
index 0accec9..46ccef6 100644
--- a/src/Daemon/BoxDaemonImpl.h
+++ b/src/Daemon/BoxDaemonImpl.h
@@ -60,13 +60,13 @@ class BoxDaemonImpl {
static int pdCreateCallback(ProviderEventArgPtr arg, void* data);
static int pdDestroyCallback(ProviderEventArgPtr arg, void* data);
static int clickedCallback(ProviderEventArgPtr arg, void* data);
- static int resizeCallback(ProviderEventArgPtr arg, void* data);
+ static int boxResizeCallback(ProviderEventArgPtr arg, void* data);
static int boxPauseCallback(ProviderEventArgPtr arg, void* data);
static int boxResumeCallback(ProviderEventArgPtr arg, void* data);
static int pauseCallback(ProviderEventArgPtr arg, void* data);
static int resumeCallback(ProviderEventArgPtr arg, void* data);
- static int updateContentCallback(ProviderEventArgPtr arg, void* data);
- static int changePeriodCallback(ProviderEventArgPtr arg, void* data);
+ static int boxPeriodChangeCallback(ProviderEventArgPtr arg, void* data);
+ static int boxUpdateCallback(ProviderEventArgPtr arg, void* data);
// common private functions
void setProviderCallbacks(ProviderCallbacks& callbacks);
diff --git a/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp b/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp
index 3602bb1..523820c 100644
--- a/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp
+++ b/src/Plugin/AppBoxPlugin/AppBoxRenderView.cpp
@@ -153,6 +153,7 @@ AppBoxRenderView::WrtCorePtr AppBoxRenderView::createWrtCore(
cbs->navigationDecide =
DPL::MakeDelegate(this, &AppBoxRenderView::decideNavigationCallback);
+ cbs->webCrash = DPL::MakeDelegate(this, &AppBoxRenderView::crashWebProcessCallback);
wrt->SetUserDelegates(cbs);
// To support transparent background
@@ -481,3 +482,10 @@ void AppBoxRenderView::decideNavigationCallback(Evas_Object* webview, std::strin
BoxSchemeHandler::Instance()->process(m_instanceId, uri);
}
}
+
+void AppBoxRenderView::crashWebProcessCallback()
+{
+ LogD("enter");
+ ewk_shutdown();
+ elm_exit();
+}
diff --git a/src/Plugin/AppBoxPlugin/AppBoxRenderView.h b/src/Plugin/AppBoxPlugin/AppBoxRenderView.h
index 0d714a0..7f34326 100644
--- a/src/Plugin/AppBoxPlugin/AppBoxRenderView.h
+++ b/src/Plugin/AppBoxPlugin/AppBoxRenderView.h
@@ -90,6 +90,7 @@ class AppBoxRenderView: public IRenderView {
void setBufferCallback(Evas_Object* webview);
void unsetBufferCallback(Evas_Object* webview);
void decideNavigationCallback(Evas_Object* webview, std::string& uri);
+ void crashWebProcessCallback();
// constructor
explicit AppBoxRenderView(
diff --git a/src/Plugin/box_plugin_interface.h b/src/Plugin/box_plugin_interface.h
index 246ab42..918caff 100644
--- a/src/Plugin/box_plugin_interface.h
+++ b/src/Plugin/box_plugin_interface.h
@@ -44,6 +44,7 @@ typedef enum {
REQUEST_CMD_RESUME_ALL,
REQUEST_CMD_PAUSE_ALL,
REQUEST_CMD_CHANGE_PERIOD,
+ REQUEST_CMD_UPDATE_BOX,
} request_cmd_type;
// definition of interface function type