mirror of
https://github.com/osukey/osukey.git
synced 2025-05-20 21:17:32 +09:00
Add update thread assertions
This commit is contained in:
parent
7ad6a1d5ff
commit
2fdf8aa1aa
@ -10,6 +10,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Development;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -144,6 +145,8 @@ namespace osu.Game.Online.Spectator
|
|||||||
|
|
||||||
public void BeginPlaying(GameplayBeatmap beatmap, Score score)
|
public void BeginPlaying(GameplayBeatmap beatmap, Score score)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(ThreadSafety.IsUpdateThread);
|
||||||
|
|
||||||
if (IsPlaying)
|
if (IsPlaying)
|
||||||
throw new InvalidOperationException($"Cannot invoke {nameof(BeginPlaying)} when already playing");
|
throw new InvalidOperationException($"Cannot invoke {nameof(BeginPlaying)} when already playing");
|
||||||
|
|
||||||
@ -172,6 +175,8 @@ namespace osu.Game.Online.Spectator
|
|||||||
|
|
||||||
public void WatchUser(int userId)
|
public void WatchUser(int userId)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(ThreadSafety.IsUpdateThread);
|
||||||
|
|
||||||
if (watchingUsers.Contains(userId))
|
if (watchingUsers.Contains(userId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -219,6 +224,8 @@ namespace osu.Game.Online.Spectator
|
|||||||
|
|
||||||
public void HandleFrame(ReplayFrame frame)
|
public void HandleFrame(ReplayFrame frame)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(ThreadSafety.IsUpdateThread);
|
||||||
|
|
||||||
if (frame is IConvertibleReplayFrame convertible)
|
if (frame is IConvertibleReplayFrame convertible)
|
||||||
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap));
|
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user