| 157 | public: |
| 158 | template <typename TInput, typename TResult> |
| 159 | static void __cdecl Run( |
| 160 | std::shared_ptr<TInput> input, |
| 161 | std::function<void(Baton<TInput, TResult>*)> doWork, |
| 162 | std::function<void(Baton<TInput, TResult>*)> afterWork, |
| 163 | Handle<Function> callback, |
| 164 | Handle<Value> receiver = Handle<Value>()) { |
| 165 | HandleScope scope; |
| 166 | Local<Object> callbackData = CreateCallbackData(callback, receiver); |
| 167 | |
| 168 | Baton<TInput, TResult>* baton = new Baton<TInput, TResult>(); |
| 169 | baton->request.data = baton; |
| 170 | baton->callbackData.Reset(callbackData); |
| 171 | baton->error_code = 0; |
| 172 | baton->data = input; |
| 173 | baton->doWork = doWork; |
| 174 | baton->afterWork = afterWork; |
| 175 | |
| 176 | uv_queue_work(uv_default_loop(), &baton->request, |
| 177 | AsyncWork<TInput, TResult>, AsyncAfter<TInput, TResult>); |
| 178 | } |
| 179 | |
| 180 | static uv_async_t* __cdecl GetAsyncToken() { |
| 181 | return TokenData::NewAsyncToken(); |
no outgoing calls
no test coverage detected