XWalkExtension::~XWalkExtension() {
if (!initialized_)
return;
-
if (shutdown_callback_)
shutdown_callback_(xw_extension_);
XWalkExtensionAdapter::GetInstance()->UnregisterExtension(this);
LOGGER(WARN) << "xw_extension (" << xw_extension << ") is invalid.";
return;
}
- if (extension_map_.find(xw_extension) != extension_map_.end())
- extension_map_.erase(xw_extension);
+ auto it = extension_map_.find(xw_extension);
+ if (it != extension_map_.end()) {
+ extension_map_.erase(it);
+ }
}
void XWalkExtensionAdapter::RegisterInstance(
LOGGER(WARN) << "xw_instance (" << xw_instance << ") is invalid.";
return;
}
- if (instance_map_.find(xw_instance) != instance_map_.end())
- instance_map_.erase(xw_instance);
+ auto it = instance_map_.find(xw_instance);
+ if (it != instance_map_.end()) {
+ instance_map_.erase(it);
+ }
}
const void* XWalkExtensionAdapter::GetInterface(const char* name) {
}
}
+void XWalkExtensionManager::UnloadExtensions() {
+ for (auto it = extensions_.begin(); it != extensions_.end(); ++it) {
+ delete it->second;
+ }
+ extensions_.clear();
+}
+
bool XWalkExtensionManager::RegisterSymbols(XWalkExtension* extension) {
std::string name = extension->name();
void LoadExtensions(bool meta_only = true);
void PreloadExtensions();
+ void UnloadExtensions();
+
private:
// override
void GetRuntimeVariable(const char* key, char* value, size_t value_len);
manager_.PreloadExtensions();
}
+void XWalkExtensionServer::Shutdown() {
+ for (auto it = instances_.begin(); it != instances_.end(); ++it) {
+ delete it->second;
+ }
+ instances_.clear();
+ manager_.UnloadExtensions();
+}
+
Json::Value XWalkExtensionServer::GetExtensions() {
Json::Value out;
auto extensions = manager_.extensions();
void HandleIPCMessage(Ewk_IPC_Wrt_Message_Data* data);
+ void Shutdown();
+
private:
XWalkExtensionServer();
virtual ~XWalkExtensionServer();
} else {
elm_exit();
}
+ auto extension_server = extensions::XWalkExtensionServer::GetInstance();
+ extension_server->Shutdown();
}
void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) {
void WebApplication::OnReceivedWrtMessage(WebView* /*view*/,
Ewk_IPC_Wrt_Message_Data* msg) {
- SCOPE_PROFILE();
Eina_Stringshare* msg_type = ewk_ipc_wrt_message_data_type_get(msg);
#define TYPE_BEGIN(x) (!strncmp(msg_type, x, strlen(x)))