From: Rafal Galka Date: Tue, 3 Mar 2015 07:59:31 +0000 (+0100) Subject: Async calls performed by sendSyncMessage X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5d039a5951bc608ef3c7d00e61e4f46be9c89aa;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git Async calls performed by sendSyncMessage [Message] Changes related to: http://168.219.209.56/gerrit/#/c/15196 [Verification] TCT results without change. Change-Id: Ifad63fba9fe4453053e5472211f8791383a1c29e --- diff --git a/src/account/account_instance.cc b/src/account/account_instance.cc index 07831e60..e2ddd731 100644 --- a/src/account/account_instance.cc +++ b/src/account/account_instance.cc @@ -54,9 +54,11 @@ AccountInstance::AccountInstance() { manager_ = new AccountManager; subscribe_ = NULL; - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&AccountInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&AccountInstance::x, this, _1, _2)); REGISTER_ASYNC("AccountManager_getAccounts", AccountManagerGetAccounts); REGISTER_ASYNC("AccountManager_getProviders", AccountManagerGetProviders); REGISTER_ASYNC("Account_getExtendedData", AccountGetExtendedData); diff --git a/src/archive/archive_instance.cc b/src/archive/archive_instance.cc index 137896a2..c1716061 100644 --- a/src/archive/archive_instance.cc +++ b/src/archive/archive_instance.cc @@ -31,11 +31,13 @@ ArchiveInstance& ArchiveInstance::getInstance() ArchiveInstance::ArchiveInstance() { LoggerD("Entered"); - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ - RegisterSyncHandler(c, std::bind(&ArchiveInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&ArchiveInstance::x, this, _1, _2)); #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&ArchiveInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&ArchiveInstance::x, this, _1, _2)); REGISTER_ASYNC("ArchiveManager_open", Open); REGISTER_SYNC("ArchiveManager_abort", Abort); diff --git a/src/badge/badge_instance.cc b/src/badge/badge_instance.cc index 58f3cd63..f1e5e7e0 100644 --- a/src/badge/badge_instance.cc +++ b/src/badge/badge_instance.cc @@ -24,7 +24,9 @@ BadgeInstance& BadgeInstance::GetInstance() { } BadgeInstance::BadgeInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c, x) \ RegisterSyncHandler(c, std::bind(&BadgeInstance::x, this, _1, _2)); REGISTER_SYNC("BadgeManager_setBadgeCount", BadgeManagerSetBadgeCount); diff --git a/src/bluetooth/bluetooth_instance.cc b/src/bluetooth/bluetooth_instance.cc index 18751a5d..91d3937b 100644 --- a/src/bluetooth/bluetooth_instance.cc +++ b/src/bluetooth/bluetooth_instance.cc @@ -52,78 +52,87 @@ BluetoothInstance& BluetoothInstance::GetInstance() BluetoothInstance::BluetoothInstance() { LoggerD("Entered"); - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + + #define REGISTER_ASYNC(c, func) \ + RegisterSyncHandler(c, func); + #define REGISTER_SYNC(c, func) \ + RegisterSyncHandler(c, func); // BluetoothAdapter - RegisterHandler("BluetoothAdapter_setName", - std::bind(&BluetoothAdapter::SetName, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_setPowered", - std::bind(&BluetoothAdapter::SetPowered, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_setVisible", - std::bind(&BluetoothAdapter::SetVisible, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_discoverDevices", - std::bind(&BluetoothAdapter::DiscoverDevices, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_stopDiscovery", - std::bind(&BluetoothAdapter::StopDiscovery, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_getKnownDevices", - std::bind(&BluetoothAdapter::GetKnownDevices, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_getDevice", - std::bind(&BluetoothAdapter::GetDevice, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_createBonding", - std::bind(&BluetoothAdapter::CreateBonding, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_destroyBonding", - std::bind(&BluetoothAdapter::DestroyBonding, bluetooth_adapter, _1, _2)); - RegisterHandler("BluetoothAdapter_registerRFCOMMServiceByUUID", - std::bind(&BluetoothAdapter::RegisterRFCOMMServiceByUUID, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_getBluetoothProfileHandler", - std::bind(&BluetoothAdapter::GetBluetoothProfileHandler, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_getName", - std::bind(&BluetoothAdapter::GetName, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_getAddress", - std::bind(&BluetoothAdapter::GetAddress, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_getPowered", - std::bind(&BluetoothAdapter::GetPowered, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_getVisible", - std::bind(&BluetoothAdapter::GetVisible, bluetooth_adapter, _1, _2)); - RegisterSyncHandler("BluetoothAdapter_isServiceConnected", - std::bind(&BluetoothAdapter::IsServiceConnected, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_setName", + std::bind(&BluetoothAdapter::SetName, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_setPowered", + std::bind(&BluetoothAdapter::SetPowered, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_setVisible", + std::bind(&BluetoothAdapter::SetVisible, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_discoverDevices", + std::bind(&BluetoothAdapter::DiscoverDevices, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_stopDiscovery", + std::bind(&BluetoothAdapter::StopDiscovery, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_getKnownDevices", + std::bind(&BluetoothAdapter::GetKnownDevices, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_getDevice", + std::bind(&BluetoothAdapter::GetDevice, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_createBonding", + std::bind(&BluetoothAdapter::CreateBonding, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_destroyBonding", + std::bind(&BluetoothAdapter::DestroyBonding, bluetooth_adapter, _1, _2)); + REGISTER_ASYNC("BluetoothAdapter_registerRFCOMMServiceByUUID", + std::bind(&BluetoothAdapter::RegisterRFCOMMServiceByUUID, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_getBluetoothProfileHandler", + std::bind(&BluetoothAdapter::GetBluetoothProfileHandler, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_getName", + std::bind(&BluetoothAdapter::GetName, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_getAddress", + std::bind(&BluetoothAdapter::GetAddress, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_getPowered", + std::bind(&BluetoothAdapter::GetPowered, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_getVisible", + std::bind(&BluetoothAdapter::GetVisible, bluetooth_adapter, _1, _2)); + REGISTER_SYNC("BluetoothAdapter_isServiceConnected", + std::bind(&BluetoothAdapter::IsServiceConnected, bluetooth_adapter, _1, _2)); // BluetoothDevice - RegisterHandler("BluetoothDevice_connectToServiceByUUID", - std::bind(&BluetoothDevice::ConnectToServiceByUUID, &bluetooth_device, _1, _2)); - RegisterSyncHandler("BluetoothDevice_getBoolValue", - std::bind(&BluetoothDevice::GetBoolValue, &bluetooth_device, _1, _2)); + REGISTER_ASYNC("BluetoothDevice_connectToServiceByUUID", + std::bind(&BluetoothDevice::ConnectToServiceByUUID, &bluetooth_device, _1, _2)); + REGISTER_SYNC("BluetoothDevice_getBoolValue", + std::bind(&BluetoothDevice::GetBoolValue, &bluetooth_device, _1, _2)); // BluetoothHealthApplication - RegisterHandler("BluetoothHealthApplication_unregister", - std::bind(&BluetoothHealthApplication::Unregister, &bluetooth_health_application, _1, _2)); + REGISTER_ASYNC("BluetoothHealthApplication_unregister", + std::bind(&BluetoothHealthApplication::Unregister, &bluetooth_health_application, _1, _2)); // BluetoothHealthChannel - RegisterSyncHandler("BluetoothHealthChannel_close", - std::bind(&BluetoothHealthChannel::Close, &bluetooth_health_channel, _1, _2)); - RegisterSyncHandler("BluetoothHealthChannel_sendData", - std::bind(&BluetoothHealthChannel::SendData, &bluetooth_health_channel, _1, _2)); + REGISTER_SYNC("BluetoothHealthChannel_close", + std::bind(&BluetoothHealthChannel::Close, &bluetooth_health_channel, _1, _2)); + REGISTER_SYNC("BluetoothHealthChannel_sendData", + std::bind(&BluetoothHealthChannel::SendData, &bluetooth_health_channel, _1, _2)); // BluetoothHealthProfileHandler - RegisterHandler("BluetoothHealthProfileHandler_registerSinkApp", - std::bind(&BluetoothHealthProfileHandler::RegisterSinkApp, bluetooth_health_profile_handler, _1, _2)); - RegisterHandler("BluetoothHealthProfileHandler_connectToSource", - std::bind(&BluetoothHealthProfileHandler::ConnectToSource, bluetooth_health_profile_handler, _1, _2)); + REGISTER_ASYNC("BluetoothHealthProfileHandler_registerSinkApp", + std::bind(&BluetoothHealthProfileHandler::RegisterSinkApp, bluetooth_health_profile_handler, _1, _2)); + REGISTER_ASYNC("BluetoothHealthProfileHandler_connectToSource", + std::bind(&BluetoothHealthProfileHandler::ConnectToSource, bluetooth_health_profile_handler, _1, _2)); // BluetoothServiceHandler - RegisterHandler("BluetoothServiceHandler_unregister", - std::bind(&BluetoothServiceHandler::Unregister, &bluetooth_service_handler, _1, _2)); + REGISTER_ASYNC("BluetoothServiceHandler_unregister", + std::bind(&BluetoothServiceHandler::Unregister, &bluetooth_service_handler, _1, _2)); // BluetoothSocket - RegisterSyncHandler("BluetoothSocket_writeData", - std::bind(&BluetoothSocket::WriteData, &bluetooth_socket, _1, _2)); - RegisterSyncHandler("BluetoothSocket_readData", - std::bind(&BluetoothSocket::ReadData, &bluetooth_socket, _1, _2)); - RegisterSyncHandler("BluetoothSocket_close", - std::bind(&BluetoothSocket::Close, &bluetooth_socket, _1, _2)); + REGISTER_SYNC("BluetoothSocket_writeData", + std::bind(&BluetoothSocket::WriteData, &bluetooth_socket, _1, _2)); + REGISTER_SYNC("BluetoothSocket_readData", + std::bind(&BluetoothSocket::ReadData, &bluetooth_socket, _1, _2)); + REGISTER_SYNC("BluetoothSocket_close", + std::bind(&BluetoothSocket::Close, &bluetooth_socket, _1, _2)); // other - RegisterSyncHandler("Bluetooth_checkPrivilege", CheckPrivilege); + REGISTER_SYNC("Bluetooth_checkPrivilege", CheckPrivilege); + + #undef REGISTER_ASYNC + #undef REGISTER_SYNC } BluetoothInstance::~BluetoothInstance() diff --git a/src/bookmark/bookmark_instance.cc b/src/bookmark/bookmark_instance.cc index 491836d0..8cad56e8 100644 --- a/src/bookmark/bookmark_instance.cc +++ b/src/bookmark/bookmark_instance.cc @@ -22,7 +22,9 @@ namespace { } // namespace BookmarkInstance::BookmarkInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&BookmarkInstance::x, this, _1, _2)); REGISTER_SYNC("Bookmark_get", BookmarkGet); diff --git a/src/calendar/calendar_instance.cc b/src/calendar/calendar_instance.cc index 2193d036..f78145a2 100644 --- a/src/calendar/calendar_instance.cc +++ b/src/calendar/calendar_instance.cc @@ -27,7 +27,9 @@ CalendarInstance& CalendarInstance::GetInstance() { } CalendarInstance::CalendarInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c, x) \ RegisterSyncHandler(c, std::bind(&CalendarInstance::x, this, _1, _2)); @@ -47,7 +49,7 @@ CalendarInstance::CalendarInstance() { #undef REGISTER_SYNC #define REGISTER_ASYNC(c, x) \ - RegisterHandler(c, std::bind(&CalendarInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&CalendarInstance::x, this, _1, _2)); REGISTER_ASYNC("Calendar_addBatch", CalendarAddBatch); REGISTER_ASYNC("Calendar_updateBatch", CalendarUpdateBatch); REGISTER_ASYNC("Calendar_removeBatch", CalendarRemoveBatch); diff --git a/src/calendar/calendar_plugin.cc b/src/calendar/calendar_plugin.cc index 14ee5e36..a0417e36 100644 --- a/src/calendar/calendar_plugin.cc +++ b/src/calendar/calendar_plugin.cc @@ -44,7 +44,8 @@ CalendarPlugin::CalendarPlugin() { CalendarPlugin::~CalendarPlugin() { manager_ = nullptr; } void CalendarPlugin::OnLoad() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; dispatcher_.AddFunction( "CalendarManager_getCalendars", diff --git a/src/callhistory/callhistory_instance.cc b/src/callhistory/callhistory_instance.cc index 77d5dcaf..2b024d4c 100644 --- a/src/callhistory/callhistory_instance.cc +++ b/src/callhistory/callhistory_instance.cc @@ -25,7 +25,9 @@ CallHistoryInstance& CallHistoryInstance::getInstance() { } CallHistoryInstance::CallHistoryInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&CallHistoryInstance::x, this, _1, _2)); REGISTER_SYNC("CallHistory_remove", Remove); @@ -33,7 +35,7 @@ CallHistoryInstance::CallHistoryInstance() { REGISTER_SYNC("CallHistory_removeChangeListener", RemoveChangeListener); #undef REGISTER_SYNC #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&CallHistoryInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&CallHistoryInstance::x, this, _1, _2)); REGISTER_ASYNC("CallHistory_find", Find); REGISTER_ASYNC("CallHistory_removeBatch", RemoveBatch); REGISTER_ASYNC("CallHistory_removeAll", RemoveAll); diff --git a/src/contact/contact_instance.cc b/src/contact/contact_instance.cc index 3e95554c..21049ffe 100644 --- a/src/contact/contact_instance.cc +++ b/src/contact/contact_instance.cc @@ -26,12 +26,13 @@ ContactInstance& ContactInstance::GetInstance() { int ContactInstance::current_state = 0; ContactInstance::ContactInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; #define REGISTER_SYNC(c, x) \ RegisterSyncHandler(c, std::bind(&ContactInstance::x, this, _1, _2)); #define REGISTER_ASYNC(c, x) \ - RegisterHandler(c, std::bind(&ContactInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&ContactInstance::x, this, _1, _2)); // Contact Manager REGISTER_ASYNC("ContactManager_getAddressBooks", diff --git a/src/content/content_instance.cc b/src/content/content_instance.cc index ed6cf97d..1c2972ee 100755 --- a/src/content/content_instance.cc +++ b/src/content/content_instance.cc @@ -31,9 +31,12 @@ using namespace common; using namespace extension::content; ContentInstance::ContentInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&ContentInstance::x, this, _1, _2)); + REGISTER_SYNC("ContentManager_find", ContentManagerFind); REGISTER_SYNC("ContentManager_update", ContentManagerUpdate); REGISTER_SYNC("ContentManager_scanFile", ContentManagerScanfile); @@ -49,11 +52,10 @@ ContentInstance::ContentInstance() { REGISTER_SYNC("ContentPlaylist_get", ContentManagerPlaylistGet); REGISTER_SYNC("ContentPlaylist_remove", ContentManagerPlaylistRemove); REGISTER_SYNC("ContentPlaylist_removeBatch", ContentManagerPlaylistRemovebatch); - REGISTER_SYNC("ContentPlaylist_setOrder", ContentManagerPlaylistSetorder); + REGISTER_SYNC("ContentPlaylist_setOrder", ContentManagerPlaylistSetorder); REGISTER_SYNC("ContentPlaylist_move", ContentManagerPlaylistMove); - REGISTER_SYNC("ContentManager_getLyrics", ContentManagerAudioGetLyrics); + REGISTER_SYNC("ContentManager_getLyrics", ContentManagerAudioGetLyrics); - // #undef REGISTER_SYNC } @@ -61,14 +63,14 @@ ContentInstance::~ContentInstance() { LoggerE("<>"); } -static void ReplyAsync(ContentInstance* instance, ContentCallbacks cbfunc, +static void ReplyAsync(ContentInstance* instance, ContentCallbacks cbfunc, double callbackId, bool isSuccess, picojson::object& param) { LoggerE("<>"); param["callbackId"] = picojson::value(static_cast(callbackId)); param["status"] = picojson::value(isSuccess ? "success" : "error"); - + picojson::value result = picojson::value(param); - + instance->PostMessage(result.serialize().c_str()); } @@ -79,7 +81,7 @@ static gboolean CompletedCallback(const std::shared_ptr& user reply["value"] = user_data->result; ReplyAsync(user_data->instance,user_data->cbType,user_data->callbackId,user_data->isSuccess,reply); - return false; + return false; } static void* WorkThread(const std::shared_ptr& user_data) { @@ -96,7 +98,7 @@ static void* WorkThread(const std::shared_ptr& user_data) { break; } case ContentManagerFindCallback: { - ContentManager::getInstance()->find(user_data); + ContentManager::getInstance()->find(user_data); break; } case ContentManagerScanfileCallback: { @@ -165,14 +167,14 @@ static void* WorkThread(const std::shared_ptr& user_data) { return NULL; } -static void changedContentCallback(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, - media_content_db_update_type_e update_type, media_content_type_e media_type, +static void changedContentCallback(media_content_error_e error, int pid, media_content_db_update_item_type_e update_item, + media_content_db_update_type_e update_type, media_content_type_e media_type, char *uuid, char *path, char *mime_type, void* user_data) { int ret; ReplyCallbackData *cbData = static_cast(user_data); picojson::object reply; - + picojson::object o; if( error == MEDIA_CONTENT_ERROR_NONE) { if( update_item == MEDIA_ITEM_FILE) { @@ -229,12 +231,12 @@ void ContentInstance::ContentManagerUpdate(const picojson::value& args, picojson void ContentInstance::ContentManagerUpdatebatch(const picojson::value& args, picojson::object& out) { LoggerE("entered"); double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; - + if(ContentManager::getInstance()->isConnected()) { cbData->cbType = ContentManagerUpdatebatchCallback; } @@ -266,7 +268,7 @@ void ContentInstance::ContentManagerFind(const picojson::value& args, picojson:: CHECK_EXIST(args, "callbackId", out) double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; @@ -305,7 +307,7 @@ void ContentInstance::ContentManagerSetchangelistener(const picojson::value& arg // std::shared_ptrcbData(new ReplyCallbackData); ReplyCallbackData *cbData = new ReplyCallbackData(); - + cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; @@ -331,7 +333,7 @@ void ContentInstance::ContentManagerGetplaylists(const picojson::value& args, pi // implement it std::shared_ptrcbData(new ReplyCallbackData); - + cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; @@ -343,7 +345,7 @@ void ContentInstance::ContentManagerGetplaylists(const picojson::value& args, pi } common::TaskQueue::GetInstance().Queue(WorkThread, CompletedCallback, cbData); - + } void ContentInstance::ContentManagerCreateplaylist(const picojson::value& args, picojson::object& out) { CHECK_EXIST(args, "callbackId", out) @@ -398,18 +400,18 @@ void ContentInstance::ContentManagerPlaylistAdd(const picojson::value& args, pic } else { ReportError(UnknownException("DB connection is failed."),out); - } + } } void ContentInstance::ContentManagerPlaylistAddbatch(const picojson::value& args, picojson::object& out) { LoggerE("entered"); double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; - + if(ContentManager::getInstance()->isConnected()) { cbData->cbType = ContentManagerPlaylistAddbatchCallback; } @@ -423,12 +425,12 @@ void ContentInstance::ContentManagerPlaylistAddbatch(const picojson::value& args void ContentInstance::ContentManagerPlaylistGet(const picojson::value& args, picojson::object& out) { LoggerE("entered"); double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; - + if(ContentManager::getInstance()->isConnected()) { cbData->cbType = ContentManagerPlaylistGetCallback; } @@ -450,18 +452,18 @@ void ContentInstance::ContentManagerPlaylistRemove(const picojson::value& args, } else { ReportError(UnknownException("DB connection is failed."),out); - } + } } void ContentInstance::ContentManagerPlaylistRemovebatch(const picojson::value& args, picojson::object& out) { LoggerE("entered"); double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; - + if(ContentManager::getInstance()->isConnected()) { cbData->cbType = ContentManagerPlaylistRemovebatchCallback; } @@ -475,12 +477,12 @@ void ContentInstance::ContentManagerPlaylistRemovebatch(const picojson::value& a void ContentInstance::ContentManagerPlaylistSetorder(const picojson::value& args, picojson::object& out) { LoggerE("entered"); double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; cbData->args = args; - + if(ContentManager::getInstance()->isConnected()) { cbData->cbType = ContentManagerPlaylistSetOrderCallback; } @@ -493,7 +495,7 @@ void ContentInstance::ContentManagerPlaylistSetorder(const picojson::value& args void ContentInstance::ContentManagerPlaylistMove(const picojson::value& args, picojson::object& out) { LoggerE("entered"); double callbackId = args.get("callbackId").get(); - + auto cbData = std::shared_ptr(new ReplyCallbackData); cbData->callbackId = callbackId; cbData->instance = this; @@ -505,7 +507,7 @@ void ContentInstance::ContentManagerPlaylistMove(const picojson::value& args, pi else { cbData->cbType = ContentManagerErrorCallback; } - common::TaskQueue::GetInstance().Queue(WorkThread, CompletedCallback, cbData); + common::TaskQueue::GetInstance().Queue(WorkThread, CompletedCallback, cbData); } void ContentInstance::ContentManagerAudioGetLyrics(const picojson::value& args, picojson::object& out) { diff --git a/src/exif/exif_instance.cc b/src/exif/exif_instance.cc index 3921cbf1..9fcf533f 100644 --- a/src/exif/exif_instance.cc +++ b/src/exif/exif_instance.cc @@ -28,8 +28,10 @@ using common::PlatformResult; using common::ErrorCode; ExifInstance::ExifInstance() { - using namespace std::placeholders; -#define REGISTER_ASYNC(c, x) RegisterHandler(c, std::bind(&ExifInstance::x, this, _1, _2)); + using std::placeholders::_1; + using std::placeholders::_2; + +#define REGISTER_ASYNC(c, x) RegisterSyncHandler(c, std::bind(&ExifInstance::x, this, _1, _2)); REGISTER_ASYNC("ExifManager_getExifInfo", ExifManagerGetExifInfo); REGISTER_ASYNC("ExifManager_saveExifInfo", ExifManagerSaveExifInfo); REGISTER_ASYNC("ExifManager_getThumbnail", ExifManagerGetThumbnail); diff --git a/src/filesystem/filesystem_instance.cc b/src/filesystem/filesystem_instance.cc index c54be7d1..345cc5f4 100644 --- a/src/filesystem/filesystem_instance.cc +++ b/src/filesystem/filesystem_instance.cc @@ -25,11 +25,14 @@ using namespace common; using namespace extension::filesystem; FilesystemInstance::FilesystemInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c, x) \ RegisterSyncHandler(c, std::bind(&FilesystemInstance::x, this, _1, _2)); #define REGISTER_ASYNC(c, x) \ - RegisterHandler(c, std::bind(&FilesystemInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&FilesystemInstance::x, this, _1, _2)); + REGISTER_ASYNC("File_stat", FileStat); REGISTER_SYNC("File_statSync", FileStatSync); REGISTER_SYNC("File_createSync", FileCreateSync); diff --git a/src/messaging/messaging_instance.cc b/src/messaging/messaging_instance.cc index 7ce5108a..405f468f 100644 --- a/src/messaging/messaging_instance.cc +++ b/src/messaging/messaging_instance.cc @@ -126,9 +126,10 @@ MessagingInstance& MessagingInstance::getInstance() MessagingInstance::MessagingInstance() { LoggerD("Entered"); - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&MessagingInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&MessagingInstance::x, this, _1, _2)); REGISTER_ASYNC(FUN_GET_MESSAGE_SERVICES, GetMessageServices); REGISTER_ASYNC(FUN_MESSAGE_SERVICE_SEND_MESSAGE, MessageServiceSendMessage); REGISTER_ASYNC(FUN_MESSAGE_SERVICE_LOAD_MESSAGE_BODY, MessageServiceLoadMessageBody); diff --git a/src/networkbearerselection/networkbearerselection_instance.cc b/src/networkbearerselection/networkbearerselection_instance.cc index 4ac386f3..6925f3a2 100644 --- a/src/networkbearerselection/networkbearerselection_instance.cc +++ b/src/networkbearerselection/networkbearerselection_instance.cc @@ -24,12 +24,14 @@ using namespace common; using namespace extension::networkbearerselection; NetworkBearerSelectionInstance::NetworkBearerSelectionInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c, x) \ RegisterSyncHandler( \ c, std::bind(&NetworkBearerSelectionInstance::x, this, _1, _2)); #define REGISTER_ASYNC(c, x) \ - RegisterHandler( \ + RegisterSyncHandler( \ c, std::bind(&NetworkBearerSelectionInstance::x, this, _1, _2)); REGISTER_SYNC("NetworkBearerSelection_requestRouteToHost", NetworkBearerSelectionRequestRouteToHost); diff --git a/src/nfc/nfc_instance.cc b/src/nfc/nfc_instance.cc index 8ca357fb..2d7ac867 100644 --- a/src/nfc/nfc_instance.cc +++ b/src/nfc/nfc_instance.cc @@ -26,7 +26,9 @@ NFCInstance& NFCInstance::getInstance() { } NFCInstance::NFCInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&NFCInstance::x, this, _1, _2)); REGISTER_SYNC("NFCManager_getDefaultAdapter", GetDefaultAdapter); @@ -74,7 +76,7 @@ NFCInstance::NFCInstance() { REGISTER_SYNC("NFCTag_isConnectedGetter", TagIsConnectedGetter); #undef REGISTER_SYNC #define REGISTER(c,x) \ - RegisterHandler(c, std::bind(&NFCInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&NFCInstance::x, this, _1, _2)); REGISTER("NFCAdapter_setPowered", SetPowered); REGISTER("NFCTag_readNDEF", ReadNDEF); REGISTER("NFCTag_writeNDEF", WriteNDEF); diff --git a/src/power/power_instance.cc b/src/power/power_instance.cc index 271990d1..5d0f1881 100755 --- a/src/power/power_instance.cc +++ b/src/power/power_instance.cc @@ -41,7 +41,9 @@ using namespace common; using namespace extension::power; PowerInstance::PowerInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&PowerInstance::x, this, _1, _2)); REGISTER_SYNC("PowerManager_turnScreenOff", PowerManagerTurnscreenoff); @@ -61,23 +63,23 @@ PowerInstance::~PowerInstance() { } enum PowerCallbacks { - PowerManagerTurnscreenoffCallback, - PowerManagerRestorescreenbrightnessCallback, - PowerManagerRequestCallback, - PowerManagerGetscreenbrightnessCallback, - PowerManagerReleaseCallback, - PowerManagerUnsetscreenstatechangelistenerCallback, - PowerManagerIsscreenonCallback, - PowerManagerTurnscreenonCallback, - PowerManagerSetscreenbrightnessCallback, + PowerManagerTurnscreenoffCallback, + PowerManagerRestorescreenbrightnessCallback, + PowerManagerRequestCallback, + PowerManagerGetscreenbrightnessCallback, + PowerManagerReleaseCallback, + PowerManagerUnsetscreenstatechangelistenerCallback, + PowerManagerIsscreenonCallback, + PowerManagerTurnscreenonCallback, + PowerManagerSetscreenbrightnessCallback, PowerManagerSetscreenstatechangelistenerCallback }; -static void ReplyAsync(PowerInstance* instance, PowerCallbacks cbfunc, +static void ReplyAsync(PowerInstance* instance, PowerCallbacks cbfunc, int callbackId, bool isSuccess, picojson::object& param) { param["callbackId"] = picojson::value(static_cast(callbackId)); param["status"] = picojson::value(isSuccess ? "success" : "error"); - + // insert result for async callback to param switch(cbfunc) { case PowerManagerRequestCallback: { @@ -127,7 +129,7 @@ static void ReplyAsync(PowerInstance* instance, PowerCallbacks cbfunc, } picojson::value result = picojson::value(param); - + instance->PostMessage(result.serialize().c_str()); } @@ -136,7 +138,7 @@ static void ReplyAsync(PowerInstance* instance, PowerCallbacks cbfunc, ReportError(TypeMismatchException(name" is required argument"), out);\ return;\ } - + void PowerInstance::PowerManagerRequest(const picojson::value& args, picojson::object& out) { const std::string& resource = args.get("resource").get(); const std::string& state = args.get("state").get(); diff --git a/src/push/push_instance.cc b/src/push/push_instance.cc index a2c91012..5b1821a0 100644 --- a/src/push/push_instance.cc +++ b/src/push/push_instance.cc @@ -11,24 +11,32 @@ namespace extension { namespace push { -PushInstance::PushInstance(): - m_ignoreNotificationEvents(true) { +PushInstance::PushInstance(): m_ignoreNotificationEvents(true) { LoggerD("Enter"); using std::placeholders::_1; using std::placeholders::_2; - RegisterHandler("Push_registerService", - std::bind(&PushInstance::registerService, this, _1, _2)); - RegisterHandler("Push_unregisterService", - std::bind(&PushInstance::unregisterService, this, _1, _2)); - RegisterSyncHandler("Push_connectService", - std::bind(&PushInstance::connectService, this, _1, _2)); - RegisterSyncHandler("Push_disconnectService", - std::bind(&PushInstance::disconnectService, this, _1, _2)); - RegisterSyncHandler("Push_getRegistrationId", - std::bind(&PushInstance::getRegistrationId, this, _1, _2)); - RegisterSyncHandler("Push_getUnreadNotifications", - std::bind(&PushInstance::getUnreadNotifications, this, _1, _2)); + + #define REGISTER_ASYNC(c, func) \ + RegisterSyncHandler(c, func); + #define REGISTER_SYNC(c, func) \ + RegisterSyncHandler(c, func); + + REGISTER_ASYNC("Push_registerService", + std::bind(&PushInstance::registerService, this, _1, _2)); + REGISTER_ASYNC("Push_unregisterService", + std::bind(&PushInstance::unregisterService, this, _1, _2)); + REGISTER_SYNC("Push_connectService", + std::bind(&PushInstance::connectService, this, _1, _2)); + REGISTER_SYNC("Push_disconnectService", + std::bind(&PushInstance::disconnectService, this, _1, _2)); + REGISTER_SYNC("Push_getRegistrationId", + std::bind(&PushInstance::getRegistrationId, this, _1, _2)); + REGISTER_SYNC("Push_getUnreadNotifications", + std::bind(&PushInstance::getUnreadNotifications, this, _1, _2)); PushManager::getInstance().setListener(this); + + #undef REGISTER_ASYNC + #undef REGISTER_SYNC } void PushInstance::registerService(const picojson::value& args, diff --git a/src/radio/radio_instance.cc b/src/radio/radio_instance.cc index 8404e44d..cd282e6d 100644 --- a/src/radio/radio_instance.cc +++ b/src/radio/radio_instance.cc @@ -19,9 +19,12 @@ using namespace common; using namespace extension::radio; RadioInstance::RadioInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&RadioInstance::x, this, _1, _2)); + REGISTER_SYNC("FMRadio_Start", Start); REGISTER_SYNC("FMRadio_Stop", Stop); REGISTER_SYNC("FMRadio_SetFMRadioInterruptedListener", SetFMRadioInterruptedListener); @@ -36,7 +39,7 @@ RadioInstance::RadioInstance() { REGISTER_SYNC("FMRadio_MuteGetter", MuteGetter); #undef REGISTER_SYNC #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&RadioInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&RadioInstance::x, this, _1, _2)); REGISTER_ASYNC("FMRadio_SeekUp", SeekUp); REGISTER_ASYNC("FMRadio_SeekDown", SeekDown); REGISTER_ASYNC("FMRadio_ScanStart", ScanStart); diff --git a/src/secureelement/secureelement_instance.cc b/src/secureelement/secureelement_instance.cc index 585f91d5..f19b6645 100644 --- a/src/secureelement/secureelement_instance.cc +++ b/src/secureelement/secureelement_instance.cc @@ -26,7 +26,8 @@ SecureElementInstance& SecureElementInstance::getInstance() { } SecureElementInstance::SecureElementInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&SecureElementInstance::x, this, _1, _2)); @@ -46,7 +47,7 @@ SecureElementInstance::SecureElementInstance() { #undef REGISTER_SYNC #define REGISTER(c,x) \ - RegisterHandler(c, std::bind(&SecureElementInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&SecureElementInstance::x, this, _1, _2)); REGISTER("SEService_getReaders", GetReaders); REGISTER("SEReader_openSession", OpenSession); diff --git a/src/sensor/sensor_instance.cc b/src/sensor/sensor_instance.cc index 6914c3d5..4e991dba 100644 --- a/src/sensor/sensor_instance.cc +++ b/src/sensor/sensor_instance.cc @@ -20,7 +20,9 @@ SensorInstance& SensorInstance::GetInstance() { } SensorInstance::SensorInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&SensorInstance::x, this, _1, _2)); REGISTER_SYNC("SensorService_getAvailableSensors", GetAvailableSensors); @@ -29,7 +31,7 @@ SensorInstance::SensorInstance() { REGISTER_SYNC("Sensor_unsetChangeListener", SensorUnsetChangeListener); #undef REGISTER_SYNC #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&SensorInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&SensorInstance::x, this, _1, _2)); REGISTER_ASYNC("Sensor_start", SensorStart); REGISTER_ASYNC("Sensor_getData", SensorGetData); #undef REGISTER_ASYNC diff --git a/src/sound/sound_instance.cc b/src/sound/sound_instance.cc index 5a6e78ec..b4d50206 100644 --- a/src/sound/sound_instance.cc +++ b/src/sound/sound_instance.cc @@ -24,7 +24,9 @@ using namespace common; using namespace extension::sound; SoundInstance::SoundInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&SoundInstance::x, this, _1, _2)); REGISTER_SYNC("SoundManager_setVolume", SoundManagerSetVolume); diff --git a/src/systeminfo/systeminfo_instance.cc b/src/systeminfo/systeminfo_instance.cc index a994b02f..333f772e 100644 --- a/src/systeminfo/systeminfo_instance.cc +++ b/src/systeminfo/systeminfo_instance.cc @@ -106,7 +106,9 @@ SysteminfoInstance& SysteminfoInstance::getInstance() { } SysteminfoInstance::SysteminfoInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; + #define REGISTER_SYNC(c,x) \ RegisterSyncHandler(c, std::bind(&SysteminfoInstance::x, this, _1, _2)); REGISTER_SYNC("SystemInfo_getCapabilities", GetCapabilities); @@ -118,7 +120,7 @@ SysteminfoInstance::SysteminfoInstance() { REGISTER_SYNC("SystemInfo_getCount", GetCount); #undef REGISTER_SYNC #define REGISTER_ASYNC(c,x) \ - RegisterHandler(c, std::bind(&SysteminfoInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&SysteminfoInstance::x, this, _1, _2)); REGISTER_ASYNC("SystemInfo_getPropertyValue", GetPropertyValue); REGISTER_ASYNC("SystemInfo_getPropertyValueArray", GetPropertyValueArray); #undef REGISTER_ASYNC diff --git a/src/systemsetting/systemsetting_instance.cc b/src/systemsetting/systemsetting_instance.cc index 197ce0d4..c16fbb8c 100644 --- a/src/systemsetting/systemsetting_instance.cc +++ b/src/systemsetting/systemsetting_instance.cc @@ -28,10 +28,11 @@ using namespace extension::systemsetting; SystemSettingInstance::SystemSettingInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; #define REGISTER(c,x) \ - RegisterHandler(c, std::bind(&SystemSettingInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&SystemSettingInstance::x, this, _1, _2)); REGISTER("SystemSettingManager_getProperty", getProperty); REGISTER("SystemSettingManager_setProperty", setProperty); diff --git a/src/time/time_instance.cc b/src/time/time_instance.cc index b9af7c41..d25bf710 100644 --- a/src/time/time_instance.cc +++ b/src/time/time_instance.cc @@ -50,12 +50,13 @@ TimeInstance& TimeInstance::GetInstance() { } TimeInstance::TimeInstance() { - using namespace std::placeholders; + using std::placeholders::_1; + using std::placeholders::_2; #define REGISTER_SYNC(c, x) \ RegisterSyncHandler(c, std::bind(&TimeInstance::x, this, _1, _2)); #define REGISTER_ASYNC(c, x) \ - RegisterHandler(c, std::bind(&TimeInstance::x, this, _1, _2)); + RegisterSyncHandler(c, std::bind(&TimeInstance::x, this, _1, _2)); REGISTER_SYNC("Time_getAvailableTimeZones", TimeGetAvailableTimeZones); REGISTER_SYNC("Time_getDSTTransition", TimeGetDSTTransition); diff --git a/src/tvchannel/tvchannel_instance.cc b/src/tvchannel/tvchannel_instance.cc index 797ee216..1158e92b 100644 --- a/src/tvchannel/tvchannel_instance.cc +++ b/src/tvchannel/tvchannel_instance.cc @@ -18,34 +18,33 @@ namespace tvchannel { using common::TaskQueue; TVChannelInstance::TVChannelInstance() { - LOGD("Entered"); - RegisterSyncHandler("TVChannelManager_getCurrentChannel", - std::bind(&TVChannelInstance::getCurrentChannel, this, - std::placeholders::_1, std::placeholders::_2)); - RegisterSyncHandler("TVChannelManager_getCurrentProgram", - std::bind(&TVChannelInstance::getCurrentProgram, this, - std::placeholders::_1, std::placeholders::_2)); - RegisterHandler("TVChannelManager_findChannel", - std::bind(&TVChannelInstance::findChannel, this, - std::placeholders::_1, - std::placeholders::_2)); - RegisterHandler("TVChannelManager_getChannelList", - std::bind(&TVChannelInstance::getChannelList, this, - std::placeholders::_1, - std::placeholders::_2)); - RegisterHandler("TVChannelManager_getProgramList", - std::bind(&TVChannelInstance::getProgramList, this, - std::placeholders::_1, - std::placeholders::_2)); - RegisterHandler("TVChannelManager_tune", - std::bind(&TVChannelInstance::tune, this, std::placeholders::_1, - std::placeholders::_2)); - RegisterHandler("TVChannelManager_tuneUp", - std::bind(&TVChannelInstance::tuneUp, this, std::placeholders::_1, - std::placeholders::_2)); - RegisterHandler("TVChannelManager_tuneDown", - std::bind(&TVChannelInstance::tuneDown, this, std::placeholders::_1, - std::placeholders::_2)); + using std::placeholders::_1; + using std::placeholders::_2; + + #define REGISTER_ASYNC(c, func) \ + RegisterSyncHandler(c, func); + #define REGISTER_SYNC(c, func) \ + RegisterSyncHandler(c, func); + + REGISTER_SYNC("TVChannelManager_getCurrentChannel", + std::bind(&TVChannelInstance::getCurrentChannel, this, _1, _2)); + REGISTER_SYNC("TVChannelManager_getCurrentProgram", + std::bind(&TVChannelInstance::getCurrentProgram, this, _1, _2)); + REGISTER_ASYNC("TVChannelManager_findChannel", + std::bind(&TVChannelInstance::findChannel, this, _1, _2)); + REGISTER_ASYNC("TVChannelManager_getChannelList", + std::bind(&TVChannelInstance::getChannelList, this, _1, _2)); + REGISTER_ASYNC("TVChannelManager_getProgramList", + std::bind(&TVChannelInstance::getProgramList, this, _1, _2)); + REGISTER_ASYNC("TVChannelManager_tune", + std::bind(&TVChannelInstance::tune, this, _1, _2)); + REGISTER_ASYNC("TVChannelManager_tuneUp", + std::bind(&TVChannelInstance::tuneUp, this, _1, _2)); + REGISTER_ASYNC("TVChannelManager_tuneDown", + std::bind(&TVChannelInstance::tuneDown, this, _1, _2)); + + #undef REGISTER_ASYNC + #undef REGISTER_SYNC m_pSubscriber = TVChannelManager::getInstance()->createSubscriber(this); TVChannelManager::getInstance()->registerListener(m_pSubscriber); diff --git a/src/tvdisplay/tvdisplay_instance.cc b/src/tvdisplay/tvdisplay_instance.cc index e9cab15c..6e285e26 100644 --- a/src/tvdisplay/tvdisplay_instance.cc +++ b/src/tvdisplay/tvdisplay_instance.cc @@ -69,18 +69,22 @@ namespace tvdisplay { TVDisplayInstance::TVDisplayInstance() { using std::placeholders::_1; using std::placeholders::_2; - RegisterSyncHandler( - "TVDisplay_is3DModeEnabled", - std::bind(&TVDisplayInstance::Is3DModeEnabled, - this, _1, _2)); - RegisterSyncHandler( - "TVDisplay_get3DEffectMode", - std::bind(&TVDisplayInstance::Get3DEffectMode, - this, _1, _2)); - RegisterHandler( - "TVDisplay_getSupported3DEffectModeList", + + #define REGISTER_ASYNC(c, func) \ + RegisterSyncHandler(c, func); + #define REGISTER_SYNC(c, func) \ + RegisterSyncHandler(c, func); + + REGISTER_SYNC("TVDisplay_is3DModeEnabled", + std::bind(&TVDisplayInstance::Is3DModeEnabled, this, _1, _2)); + REGISTER_SYNC("TVDisplay_get3DEffectMode", + std::bind(&TVDisplayInstance::Get3DEffectMode,this, _1, _2)); + REGISTER_ASYNC("TVDisplay_getSupported3DEffectModeList", std::bind(&TVDisplayInstance::GetSupported3DEffectModeList, - this, _1, _2)); + this, _1, _2)); + + #undef REGISTER_ASYNC + #undef REGISTER_SYNC } TVDisplayInstance::~TVDisplayInstance() {} diff --git a/src/websetting/websetting_instance.cc b/src/websetting/websetting_instance.cc index 7fa7af75..229d7118 100644 --- a/src/websetting/websetting_instance.cc +++ b/src/websetting/websetting_instance.cc @@ -32,14 +32,18 @@ typedef std::string JsonString; WebSettingInstance::WebSettingInstance(WebSettingExtension* extension) : extension_(extension) { - using namespace std::placeholders; -#define REGISTER_ASYNC(c, x) \ - RegisterHandler(c, std::bind(&WebSettingInstance::x, this, _1, _2)); + using std::placeholders::_1; + using std::placeholders::_2; + + #define REGISTER_ASYNC(c, x) \ + RegisterSyncHandler(c, std::bind(&WebSettingInstance::x, this, _1, _2)); + REGISTER_ASYNC("WebSettingManager_setUserAgentString", WebSettingManagerSetUserAgentString); REGISTER_ASYNC("WebSettingManager_removeAllCookies", WebSettingManagerRemoveAllCookies); -#undef REGISTER_ASYNC + + #undef REGISTER_ASYNC } WebSettingInstance::~WebSettingInstance() {}