| 311 | void invoke(const std::function<void()>& func) { begin_invoke(func).get(); } |
| 312 | |
| 313 | std::future<void> begin_invoke(const std::function<void()>& func) |
| 314 | { |
| 315 | CefRefPtr<cef_task> task = new cef_task(func); |
| 316 | |
| 317 | if (CefCurrentlyOn(TID_UI)) { |
| 318 | // Avoid deadlock. |
| 319 | task->Execute(); |
| 320 | return task->future(); |
| 321 | } |
| 322 | |
| 323 | if (CefPostTask(TID_UI, task.get())) { |
| 324 | return task->future(); |
| 325 | } |
| 326 | CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("[cef_executor] Could not post task")); |
| 327 | } |
| 328 | |
| 329 | } // namespace caspar::html |
no test coverage detected