Address second iteration CR comments
This commit is contained in:
Родитель
a6b3cb0f7d
Коммит
b5e6dbf64c
|
@ -268,11 +268,11 @@ extern "C" {
|
|||
const char* id;
|
||||
int64_t delayMs;
|
||||
const char* typeName;
|
||||
} task_data_t;
|
||||
} evt_task_t;
|
||||
|
||||
/* Async worker thread callback function signatures */
|
||||
typedef void (EVTSDK_LIBABI_CDECL *task_callback_fn_t)(const char* /*taskId*/);
|
||||
typedef void (EVTSDK_LIBABI_CDECL *task_dispatcher_queue_fn_t)(task_data_t*, task_callback_fn_t);
|
||||
typedef void(EVTSDK_LIBABI_CDECL* task_dispatcher_queue_fn_t)(evt_task_t*, task_callback_fn_t);
|
||||
typedef bool (EVTSDK_LIBABI_CDECL *task_dispatcher_cancel_fn_t)(const char* /*taskId*/);
|
||||
typedef void (EVTSDK_LIBABI_CDECL *task_dispatcher_join_fn_t)();
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace PAL_NS_BEGIN {
|
|||
auto ownedItem = std::unique_ptr<Task>(task);
|
||||
|
||||
// Create task
|
||||
task_data_t capiTask;
|
||||
evt_task_t capiTask;
|
||||
std::string taskId = GetNextTaskId();
|
||||
capiTask.id = taskId.c_str();
|
||||
capiTask.typeName = ownedItem->TypeName.c_str();
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace
|
|||
void SetShouldExecute(bool shouldExecute) { m_shouldExecute = shouldExecute; }
|
||||
bool ShouldExecute() { return m_shouldExecute; }
|
||||
|
||||
void SetQueueValidation(std::function<void(task_data_t*)> fn)
|
||||
void SetQueueValidation(std::function<void(evt_task_t*)> fn)
|
||||
{
|
||||
m_validateQueueFn = fn;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace
|
|||
void SetJoinValidation(std::function<void()> fn) { m_validateJoinFn = fn; }
|
||||
void SetCallbackValidation(std::function<void(int, int)> fn) { m_validateCallbackFn = fn; }
|
||||
|
||||
void OnQueue(task_data_t* task)
|
||||
void OnQueue(evt_task_t* task)
|
||||
{
|
||||
if (m_validateQueueFn)
|
||||
m_validateQueueFn(task);
|
||||
|
@ -53,7 +53,7 @@ namespace
|
|||
|
||||
private:
|
||||
bool m_shouldExecute = false;
|
||||
std::function<void(task_data_t*)> m_validateQueueFn;
|
||||
std::function<void(evt_task_t*)> m_validateQueueFn;
|
||||
std::function<void(const char*)> m_validateCancelFn;
|
||||
std::function<void()> m_validateJoinFn;
|
||||
std::function<void(int, int)> m_validateCallbackFn;
|
||||
|
@ -86,7 +86,7 @@ namespace
|
|||
};
|
||||
} // namespace
|
||||
|
||||
void EVTSDK_LIBABI_CDECL OnTaskDispatcherQueue(task_data_t* task, task_callback_fn_t callback)
|
||||
void EVTSDK_LIBABI_CDECL OnTaskDispatcherQueue(evt_task_t* task, task_callback_fn_t callback)
|
||||
{
|
||||
s_testHelper->OnQueue(task);
|
||||
|
||||
|
@ -104,7 +104,7 @@ void EVTSDK_LIBABI_CDECL OnTaskDispatcherJoin()
|
|||
s_testHelper->OnJoin();
|
||||
}
|
||||
|
||||
void CheckTaskTypeNameIsExpectedOrEmptyIfRTTIIsEnabled(task_data_t* task) noexcept
|
||||
void CheckTaskTypeNameIsExpectedOrEmptyIfRTTIIsEnabled(evt_task_t* task) noexcept
|
||||
{
|
||||
std::string typeName { task->typeName };
|
||||
#if HAS_RTTI
|
||||
|
@ -123,7 +123,7 @@ TEST(TaskDispatcherCAPITests, Execute)
|
|||
|
||||
// Validate C++ -> C transformation of task
|
||||
bool wasQueued = false;
|
||||
testHelper->SetQueueValidation([&wasQueued](task_data_t* task) {
|
||||
testHelper->SetQueueValidation([&wasQueued](evt_task_t* task) {
|
||||
wasQueued = true;
|
||||
EXPECT_EQ(task->delayMs, 0);
|
||||
CheckTaskTypeNameIsExpectedOrEmptyIfRTTIIsEnabled(task);
|
||||
|
@ -152,7 +152,7 @@ TEST(TaskDispatcherCAPITests, Schedule)
|
|||
|
||||
// Validate C++ -> C transformation of task
|
||||
bool wasQueued = false;
|
||||
testHelper->SetQueueValidation([&wasQueued](task_data_t* task) {
|
||||
testHelper->SetQueueValidation([&wasQueued](evt_task_t* task) {
|
||||
wasQueued = true;
|
||||
EXPECT_NE(task->delayMs, 0);
|
||||
CheckTaskTypeNameIsExpectedOrEmptyIfRTTIIsEnabled(task);
|
||||
|
@ -182,7 +182,7 @@ TEST(TaskDispatcherCAPITests, Cancel)
|
|||
// Validate C++ -> C transformation of task
|
||||
string taskIdStr;
|
||||
bool wasQueued = false;
|
||||
testHelper->SetQueueValidation([&wasQueued, &taskIdStr](task_data_t* task) {
|
||||
testHelper->SetQueueValidation([&wasQueued, &taskIdStr](evt_task_t* task) {
|
||||
wasQueued = true;
|
||||
taskIdStr = task->id;
|
||||
EXPECT_NE(task->delayMs, 0);
|
||||
|
|
Загрузка…
Ссылка в новой задаче