Remove useless stopped lamda registering in async-client 22/74922/2
authorKyungwook Tak <k.tak@samsung.com>
Thu, 16 Jun 2016 05:50:57 +0000 (14:50 +0900)
committerKyungwook Tak <k.tak@samsung.com>
Thu, 16 Jun 2016 08:47:48 +0000 (17:47 +0900)
No custom isStopped() lamda will be registered at all so this
functionality isn't needed.

Change-Id: Iade85a824a72e36ff4f2a4a4c9a1e838611d1697
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
src/framework/client/async-logic.cpp
src/framework/client/async-logic.h
src/framework/client/content-screening.cpp

index e66c265..e6c18ab 100644 (file)
 namespace Csr {
 namespace Client {
 
-AsyncLogic::AsyncLogic(HandleExt *handle, void *userdata,
-                                          const std::function<bool()> &isStopped) :
+AsyncLogic::AsyncLogic(HandleExt *handle, void *userdata) :
        m_handle(handle),
        m_ctx(new CsContext),
        m_cb(handle->m_cb),
        m_userdata(userdata),
-       m_isStopped(isStopped),
        m_dispatcher(new Dispatcher(SockId::CS))
 {
        // disable ask user option for async request for now
@@ -95,7 +93,7 @@ void AsyncLogic::scanDir(const std::string &dir)
 void AsyncLogic::scanFiles(const StrSet &fileSet)
 {
        for (const auto &file : fileSet) {
-               if (this->m_isStopped())
+               if (this->m_handle->isStopped())
                        ThrowExc(-999, "Async op cancelled!");
 
                auto ret = this->m_dispatcher->methodCall<std::pair<int, CsDetected *>>(
index d20b943..f245674 100644 (file)
@@ -35,8 +35,7 @@ namespace Client {
 
 class AsyncLogic {
 public:
-       AsyncLogic(HandleExt *handle, void *userdata,
-                          const std::function<bool()> &isStopped);
+       AsyncLogic(HandleExt *handle, void *userdata);
        virtual ~AsyncLogic();
 
        void scanFiles(const StrSet &files);
@@ -49,14 +48,13 @@ private:
        template<typename T>
        void copyKvp(CsContext::Key);
 
-       Handle *m_handle; // for registering results for auto-release
+       HandleExt *m_handle; // for registering results for auto-release
 
        ContextPtr m_ctx;
        std::vector<ResultPtr> m_results;
 
        Callback m_cb;
        void *m_userdata;
-       std::function<bool()> m_isStopped;
 
        std::unique_ptr<Dispatcher> m_dispatcher;
 };
@@ -66,8 +64,8 @@ void AsyncLogic::copyKvp(CsContext::Key key)
 {
        T value;
 
-       m_handle->getContext()->get(static_cast<int>(key), value);
-       m_ctx->set(static_cast<int>(key), value);
+       this->m_handle->getContext()->get(static_cast<int>(key), value);
+       this->m_ctx->set(static_cast<int>(key), value);
 }
 
 }
index f9d0fcc..712538f 100644 (file)
@@ -404,7 +404,7 @@ int csr_cs_scan_files_async(csr_cs_context_h handle, const char *file_paths[],
                else
                        canonicalizedFiles = std::move(ret.second);
 
-               Client::AsyncLogic l(hExt, user_data, [&hExt] { return hExt->isStopped(); });
+               Client::AsyncLogic l(hExt, user_data);
 
                l.scanFiles(*canonicalizedFiles);
 
@@ -443,7 +443,7 @@ int csr_cs_scan_dir_async(csr_cs_context_h handle, const char *dir_path,
        auto task = std::make_shared<Task>([hExt, user_data, dir] {
                EXCEPTION_ASYNC_SAFE_START(hExt->m_cb, user_data)
 
-               Client::AsyncLogic l(hExt, user_data, [&hExt] { return hExt->isStopped(); });
+               Client::AsyncLogic l(hExt, user_data);
 
                l.scanDir(*dir);
 
@@ -505,7 +505,7 @@ int csr_cs_scan_dirs_async(csr_cs_context_h handle, const char *dir_paths[],
 
                Client::eraseSubdirectories(*canonicalizedDirs);
 
-               Client::AsyncLogic l(hExt, user_data, [&hExt] { return hExt->isStopped(); });
+               Client::AsyncLogic l(hExt, user_data);
 
                l.scanDirs(*canonicalizedDirs);