#include <widget_errno.h>
#include <widget_instance.h>
+#include <stdexcept>
+
#include <app_core_multi_window_base.hh>
#include "common/log_private.hh"
app_id_ = app_id;
}
+/* LCOV_EXCL_START */
const std::string& GetAppId() const {
return app_id_;
}
+/* LCOV_EXCL_STOP */
void SetPackageId(const std::string& package_id) {
package_id_ = package_id;
bool IsPermanent() const {
return permanent_;
}
-
+/* LCOV_EXCL_START */
void SetFgSignal(bool fg_signal) {
fg_signal_ = fg_signal;
}
bool IsFgSignal() const {
return fg_signal_;
}
+/* LCOV_EXCL_STOP */
int SendUpdateStatus(const std::string& class_id,
const std::string& instance_id, int status, int err,
std::unique_ptr<tizen_base::Bundle> args_;
std::string content_;
- double period_;
+ double period_ = 0.0f;
guint periodic_timer_ = 0;
- bool pending_update_;
+ bool pending_update_ = false;
std::string pending_content_;
};
return 0;
}
+/* LCOV_EXCL_START */
void WidgetContext::Impl::OnUpdate(bool force) {
parent_->OnUpdate(pending_content_.empty() ? tizen_base::Bundle() :
tizen_base::Bundle(pending_content_), force);
WIDGET_INSTANCE_EVENT_UPDATE, 0, nullptr);
_D("Updated: %s", id.c_str());
}
+/* LCOV_EXCL_STOP */
void WidgetContext::Impl::UpdateProcess(const tizen_base::Bundle& b) {
bool force;
}
}
+/* LCOV_EXCL_START */
void WidgetContext::Impl::SetPeriod(double period) {
period_ = period;
}
TimedOutCb, parent_);
}
}
+/* LCOV_EXCL_STOP */
void WidgetContext::Impl::UnsetPeriodicTimer() {
if (periodic_timer_) {
}
}
+/* LCOV_EXCL_START */
gboolean WidgetContext::Impl::TimedOutCb(gpointer user_data) {
WidgetContext* wc = reinterpret_cast<WidgetContext*>(user_data);
if (wc->IsResumed()) {
return G_SOURCE_CONTINUE;
}
+/* LCOV_EXCL_STOP */
WidgetContext::WidgetContext(std::string context_id, std::string inst_id,
AppCoreMultiWindowBase* app)
WidgetContext::~WidgetContext() = default;
+/* LCOV_EXCL_START */
void WidgetContext::OnPause() {
std::string id = GetInstId();
_D("WidgetContext(%s) is paused", id.c_str());
__context.SetFgSignal(true);
}
}
+/* LCOV_EXCL_STOP */
void WidgetContext::OnResize(int w, int h) {
}
return WIDGET_ERROR_FAULT;
}
+ try {
+ auto contents_raw = const_cast<tizen_base::Bundle&>(contents).ToRaw();
+ impl_->content_ = std::string(
+ reinterpret_cast<char*>(contents_raw.first.get()));
+ } catch (const std::bad_alloc& e) {
+ impl_->content_ = "";
+ _E("Exception(%s) occurs", e.what());
+ }
+
return WIDGET_ERROR_NONE;
}
reason = DestroyType::PERMANENT;
}
- tizen_base::Bundle content_info = impl_->content_.empty() ?
- tizen_base::Bundle() : tizen_base::Bundle(impl_->content_);
+ tizen_base::Bundle content_info;
+ try {
+ if (!impl_->content_.empty())
+ content_info = tizen_base::Bundle(impl_->content_);
+ } catch (const std::bad_alloc& e) {
+ _E("Exception(%s) occurs", e.what());
+ }
OnDestroy(reason, content_info);