Browse Source
* Don't tick with render loop when app is idle * Update src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * wip * wip * api diff * fixes * Address review: clear wakeupPending at tick start, guard CarbonEmissionsHack subscriptions - Clear _wakeupPending at start of TimerTick so wakeups already processed by the current tick don't force an unnecessary extra tick - Guard CarbonEmissionsHack against duplicate subscriptions using a private attached property Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix lock-order inversion in Add/Remove vs TimerTick Move Wakeup() and Stop() calls outside the _items lock in Add/Remove to prevent deadlock with TimerTick which acquires _timerLock then _items. Add/Remove are UI-thread-only so the extracted logic remains safe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address review: remove unused usings, guard double Stop(), fix SleepLoop extra frame - Remove unused using directives from IRenderLoopTask.cs - Guard TimerTick Stop() with _running check to prevent double Stop() when Remove() already stopped the timer - SleepLoopRenderTimer: use WaitOne(timeout) instead of Thread.Sleep so Stop() can interrupt the sleep, and recheck _stopped before Tick Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix DisplayLinkTimer foreground handler bypassing render loop state Only resume the display link on WillEnterForeground if the timer was calling Start() to avoid setting _stopped=false when the render loop had the timer stopped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix DisplayLinkTimer thread safety, revert global NU5104 suppression - Stop() now only sets _stopped flag; OnLinkTick() self-pauses the CADisplayLink from the timer thread to avoid thread-affinity issues - Revert NU5104 global suppression in SharedVersion.props Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Cap _ticksSinceLastCommit to prevent int overflow Stop incrementing once it reaches CommitGraceTicks to prevent wrapping negative and keeping the render loop awake indefinitely. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * refactor: remove Start/Stop from IRenderTimer, merge into Tick setter Timer start/stop is now controlled entirely by setting the Tick property: non-null starts, null stops. This eliminates the explicit Start()/Stop() methods from IRenderTimer, making the API simpler. DefaultRenderLoop controls the timer purely through Tick assignment under its _timerLock. A new _hasItems flag tracks subscriber presence since Tick is now transient (null when idle). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: address review comments on timer thread safety and guards - ChoreographerTimer: add _frameCallbackActive guard to prevent double PostFrameCallback from both Tick setter and SubscribeView - ServerCompositor: cap _ticksSinceLastCommit at int.MaxValue - SleepLoopRenderTimer: make _tick volatile, remove _stopped recheck (guard moved to DefaultRenderLoop) - DefaultRenderLoop: add _running check at tick start to drop late ticks - ThreadProxyRenderTimer: add lock for internal state manipulation - DisplayLinkTimer: add lock for all internal state manipulation - Re-add NU5104 suppression to SharedVersion.props Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: make _hasItems volatile for cross-thread visibility Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: guard against redundant starts in DefaultRenderTimer, make _tick volatile across all timers Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove CarbonEmissionsHack, revert iOS/Android timers to always-ticking - Delete CarbonEmissionsHack class and its XAML reference - Revert DisplayLinkTimer (iOS) to original always-ticking implementation - Revert ChoreographerTimer (Android) to original always-ticking implementation - Add TODO comments for future start/stop on RenderLoop request Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix DirectCompositionConnection WaitOne not respecting process exit cancellation Use WaitHandle.WaitAny with both _wakeEvent and cts.Token.WaitHandle so the loop can exit when ProcessExit fires while the timer is stopped. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * timers * XML docs * Cache delegate --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>maxkatz6-patch-1
committed by
GitHub
43 changed files with 632 additions and 298 deletions
@ -1,10 +1,7 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Avalonia.Rendering |
|||
{ |
|||
internal interface IRenderLoopTask |
|||
{ |
|||
void Render(); |
|||
bool Render(); |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue