#include <Widget/IWidget.h>
#include <LocalStorage/LocalStorageMgr.h>
#include <Commons/WrtAccess/WrtAccess.h>
+#include <dpl/wrt-dao-ro/wrt_db_types.h>
+#include <CommonsJavaScript/JSLifeManager.h>
// temporary
extern "C" JSGlobalContextRef JSContextGetGlobalContext(JSContextRef ctx);
{
Widget::Api::IWidgetPtr iwidget;
JSObjectRef preferencesObject;
- //TEMP
- //int widgetId // TODO: check is it necessary (g.rynkowski)
JSObjectRef widgetObject;
};
typedef std::shared_ptr<WidgetPrivateObject> WidgetPrivateObjectPtr;
return priv->getObject()->iwidget;
}
-LocalStorage::Api::ILocalStoragePtr getLocalStorage(int widgetId)
+LocalStorage::Api::ILocalStoragePtr getLocalStorage(WidgetHandle widgetId)
{
LocalStorage::Api::ILocalStoragePtr storage(
LocalStorage::Api::getLocalStorage(widgetId));
JSObjectRef createPreferencesObject(JSContextRef context,
JSObjectRef widgetObject,
- int widgetId)
+ WidgetHandle widgetId)
{
AssertMsg(widgetObject, "Widget Object can'n be null");
//delete is invoked in JSPreferences::finalize
delete priv;
}
//Unprotect is called in JSWidget::finalize
- JSValueProtect(context, preferences);
+ JSValueSafeProtect(context, preferences);
return preferences;
}
LogDebug("entered. Context : " << context << "(global:" << g_context << "), Object: " << object);
- if (context != g_context)
- {
+ if (context != g_context) {
context = g_context;
}
Widget::Api::IWidgetPtr widget =
Api::WidgetFactory::createWidget();
- int widgetId = WrtAccessSingleton::Instance().getWidgetId();
+ WidgetHandle widgetId = WrtAccessSingleton::Instance().getWidgetId();
JSObjectRef preferences =
createPreferencesObject(context,
object,
void JSWidget::finalize(JSObjectRef object)
{
LogDebug("entered");
- LogDebug("Object: " << object);
JSWidgetPrivateObject* priv =
static_cast<JSWidgetPrivateObject*>(JSObjectGetPrivate(object));
if (priv) {
- JSValueUnprotect(priv->getContext(),
+ JSValueSafeUnprotect(priv->getContext(),
priv->getObject()->preferencesObject);
delete priv;
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("Object: " << object);
-
Try {
Converter converter(context);