abstract */
| 2125 | }; |
| 2126 | |
| 2127 | /* abstract */ class AsyncBareProgressWorkerBase : public AsyncWorker { |
| 2128 | public: |
| 2129 | explicit AsyncBareProgressWorkerBase( |
| 2130 | Callback *callback_, |
| 2131 | const char* resource_name = "nan:AsyncBareProgressWorkerBase") |
| 2132 | : AsyncWorker(callback_, resource_name) { |
| 2133 | uv_async_init( |
| 2134 | GetCurrentEventLoop() |
| 2135 | , &async |
| 2136 | , AsyncProgress_ |
| 2137 | ); |
| 2138 | async.data = this; |
| 2139 | } |
| 2140 | |
| 2141 | virtual ~AsyncBareProgressWorkerBase() { |
| 2142 | } |
| 2143 | |
| 2144 | virtual void WorkProgress() = 0; |
| 2145 | |
| 2146 | virtual void Destroy() { |
| 2147 | uv_close(reinterpret_cast<uv_handle_t*>(&async), AsyncClose_); |
| 2148 | } |
| 2149 | |
| 2150 | private: |
| 2151 | inline static NAUV_WORK_CB(AsyncProgress_) { |
| 2152 | AsyncBareProgressWorkerBase *worker = |
| 2153 | static_cast<AsyncBareProgressWorkerBase*>(async->data); |
| 2154 | worker->WorkProgress(); |
| 2155 | } |
| 2156 | |
| 2157 | inline static void AsyncClose_(uv_handle_t* handle) { |
| 2158 | AsyncBareProgressWorkerBase *worker = |
| 2159 | static_cast<AsyncBareProgressWorkerBase*>(handle->data); |
| 2160 | delete worker; |
| 2161 | } |
| 2162 | |
| 2163 | protected: |
| 2164 | uv_async_t async; |
| 2165 | }; |
| 2166 | |
| 2167 | template<class T> |
| 2168 | /* abstract */ |
nothing calls this directly
no outgoing calls
no test coverage detected