1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 18:52:55 +08:00

Add update thread asserts to RoomManager methods

This commit is contained in:
Dean Herbert 2021-12-10 17:22:24 +09:00
parent 3633494509
commit 970a9ae074

View File

@ -7,11 +7,13 @@ using System.Diagnostics;
using System.Linq; using System.Linq;
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.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Utils;
namespace osu.Game.Screens.OnlinePlay.Components namespace osu.Game.Screens.OnlinePlay.Components
{ {
@ -107,6 +109,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
public void AddOrUpdateRoom(Room room) public void AddOrUpdateRoom(Room room)
{ {
Debug.Assert(ThreadSafety.IsUpdateThread);
Debug.Assert(room.RoomID.Value != null); Debug.Assert(room.RoomID.Value != null);
if (ignoredRooms.Contains(room.RoomID.Value.Value)) if (ignoredRooms.Contains(room.RoomID.Value.Value))
@ -136,12 +139,16 @@ namespace osu.Game.Screens.OnlinePlay.Components
public void RemoveRoom(Room room) public void RemoveRoom(Room room)
{ {
Debug.Assert(ThreadSafety.IsUpdateThread);
rooms.Remove(room); rooms.Remove(room);
notifyRoomsUpdated(); notifyRoomsUpdated();
} }
public void ClearRooms() public void ClearRooms()
{ {
Debug.Assert(ThreadSafety.IsUpdateThread);
rooms.Clear(); rooms.Clear();
notifyRoomsUpdated(); notifyRoomsUpdated();
} }