| 845 | } |
| 846 | |
| 847 | void Application::queueRecomputeRequest(RecomputeRequest req) |
| 848 | { |
| 849 | if (!canRecomputeRequestOnWorker(req)) { |
| 850 | RecomputeResult result; |
| 851 | |
| 852 | // Requests that are not worker-safe stay on the caller thread unless a |
| 853 | // GUI main-thread hop is required. In App-only/headless mode there are |
| 854 | // no GUI hooks, so processing inline preserves the "stay off the |
| 855 | // worker" guarantee without inventing a synthetic main thread. |
| 856 | if (App::MainThreadSignalConfig::hasHooks() |
| 857 | && !App::MainThreadSignalConfig::isMainThread()) { |
| 858 | App::MainThreadSignalConfig::invoke( |
| 859 | [&req, &result]() { result = processRecomputeRequest(req); }, |
| 860 | /*blocking=*/true |
| 861 | ); |
| 862 | } |
| 863 | else { |
| 864 | result = processRecomputeRequest(req); |
| 865 | } |
| 866 | |
| 867 | if (req.callback) { |
| 868 | req.callback(req, result); |
| 869 | } |
| 870 | return; |
| 871 | } |
| 872 | |
| 873 | { |
| 874 | std::lock_guard<std::mutex> lock(_recomputeMutex); |
| 875 | _recomputeRequests.push_back(std::move(req)); |
| 876 | } |
| 877 | notifyRecomputeWorker(); |
| 878 | } |
| 879 | |
| 880 | void Application::cancelRecomputeRequestsForDocument(const std::string& documentName) |
| 881 | { |
no test coverage detected