| 2551 | } |
| 2552 | |
| 2553 | Result JavascriptThreadPool::executeQueue(const Task::Type& t, PendingCompilationList& pendingCompilations) |
| 2554 | { |
| 2555 | Result r = Result::ok(); |
| 2556 | |
| 2557 | auto alreadyCompiled = [pendingCompilations](const CallbackTask& t) |
| 2558 | { |
| 2559 | return pendingCompilations.contains(t.getFunction().getProcessor()); |
| 2560 | }; |
| 2561 | |
| 2562 | switch (t) |
| 2563 | { |
| 2564 | case Task::Type::Compilation: |
| 2565 | { |
| 2566 | CompilationTask ct; |
| 2567 | |
| 2568 | allowSleep = true; |
| 2569 | |
| 2570 | TRACE_EVENT("scripting", "compile queue");//, perfetto::Track(CompilationTrackId)); |
| 2571 | |
| 2572 | while (compilationQueue.pop(ct)) |
| 2573 | { |
| 2574 | SimpleReadWriteLock::ScopedWriteLock sl(getLookAndFeelRenderLock()); |
| 2575 | SuspendHelpers::ScopedTicket ticket; |
| 2576 | |
| 2577 | clearCounter(Task::LowPriorityCallbackExecution); |
| 2578 | clearCounter(Task::HiPriorityCallbackExecution); |
| 2579 | clearCounter(Task::DeferredPanelRepaintJob); |
| 2580 | |
| 2581 | lowPriorityQueue.clear(); |
| 2582 | highPriorityQueue.clear(); |
| 2583 | |
| 2584 | #if PERFETTO |
| 2585 | dispatch::StringBuilder b; |
| 2586 | b << "compile " << dynamic_cast<Processor*>(ct.getFunction().getProcessor())->getId(); |
| 2587 | TRACE_DYNAMIC_SCRIPTING(b); |
| 2588 | #endif |
| 2589 | |
| 2590 | killVoicesAndExtendTimeOut(ct.getFunction().getProcessor()); |
| 2591 | |
| 2592 | r = ct.call(); |
| 2593 | |
| 2594 | pendingCompilations.addIfNotAlreadyThere(ct.getFunction().getProcessor()); |
| 2595 | } |
| 2596 | |
| 2597 | clearCounter(t); |
| 2598 | |
| 2599 | |
| 2600 | return r; |
| 2601 | } |
| 2602 | case Task::ReplEvaluation: |
| 2603 | { |
| 2604 | r = executeQueue(Task::Compilation, pendingCompilations); |
| 2605 | |
| 2606 | #if USE_BACKEND |
| 2607 | CallbackTask hpt; |
| 2608 | |
| 2609 | while (r.wasOk() && replQueue.pop(hpt)) |
| 2610 | { |
no test coverage detected