Implements DynamicPluginStopSession inteface like below.
extern "C" void DynamicPluginStopSession(
const char* tizen_id, v8::Handle<v8::Context> context)
Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=12998
Reviewed by: Antonio Gomes, Hyunhak Kim, arno renevier
Change-Id: I4f98a152b062a63dcdf4826a53ec8867f1f85112
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
namespace {
const char* const START_SESSION_FUNCTION = "DynamicPluginStartSession";
+const char* const STOP_SESSION_FUNCTION = "DynamicPluginStopSession";
const char* const URL_PARSING_FUNCTION = "DynamicUrlParsing";
const char* const SET_WIDGET_INFO_FUNCTION = "DynamicSetWidgetInfo";
const char* const DATABASE_ATTACH_FUNCTION = "DynamicDatabaseAttach";
DynamicPlugin::DynamicPlugin()
: m_handle(0),
m_startSession(0),
+ m_stopSession(0),
m_parseURL(0),
m_setWidgetInfo(0),
m_databaseAttach(0) {
if (!m_startSession) {
LOG(ERROR) << "No " << START_SESSION_FUNCTION << " symbol found!\n";
}
+ *reinterpret_cast<void **>(&m_stopSession) = dlsym(m_handle, STOP_SESSION_FUNCTION);
+ if (!m_stopSession) {
+ LOG(ERROR) << "No " << STOP_SESSION_FUNCTION << " symbol found!\n";
+ }
*reinterpret_cast<void **>(&m_parseURL) = dlsym(m_handle, URL_PARSING_FUNCTION);
if (!m_parseURL) {
LOG(ERROR) << "No " << URL_PARSING_FUNCTION << " symbol found!\n";
theme, baseURL);
}
+void DynamicPlugin::stopSession(const char* tizen_id,
+ v8::Handle<v8::Context> context) {
+ if (!m_stopSession || !m_databaseAttach)
+ return;
+ m_stopSession(tizen_id, context);
+}
+
void DynamicPlugin::parseURL(std::string* old_url, std::string* new_url, const char* tizen_id) {
if (!m_parseURL || !m_databaseAttach)
return;
const char* encodedBundle,
const char* theme,
const char* baseURL);
+typedef void (*stopSessionFun)(const char* tizen_id,
+ v8::Handle<v8::Context> context);
typedef void (*onIPCMessageFun)(
const Ewk_Wrt_Message_Data& data);
typedef void (*parseUrlFun)(std::string* old_url,
const char* encodedBundle,
const char* theme,
const char* baseURL);
-
+ void stopSession(const char* tizen_id,
+ v8::Handle<v8::Context> context);
void parseURL(std::string* old_url, std::string* new_url, const char* tizen_id);
void setWidgetInfo(const std::string& tizen_id);
void messageReceived(const Ewk_Wrt_Message_Data& data);
void* m_handle;
startSessionFun m_startSession;
+ stopSessionFun m_stopSession;
parseUrlFun m_parseURL;
setWidgetInfoFun m_setWidgetInfo;
databaseAttachFun m_databaseAttach;
}
void WrtWidget::StopSession(v8::Handle<v8::Context> context) {
- //TODO: stop session
+ if (!tizen_id_.empty() && !context.IsEmpty()) {
+ DynamicPlugin::instance().stopSession(tizen_id_.c_str(), context);
+ }
}
void WrtWidget::MessageReceived(const Ewk_Wrt_Message_Data& data) {