Remove track store reference counting, use single instance stores

This commit is contained in:
smoogipoo
2020-08-11 13:16:06 +09:00
parent 6aafb3d271
commit 338c01fa43
2 changed files with 13 additions and 40 deletions

View File

@ -19,21 +19,16 @@ namespace osu.Game.Beatmaps
{
protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap
{
public readonly TextureStore TextureStore;
public readonly ITrackStore TrackStore;
private readonly IResourceStore<byte[]> store;
private readonly Action<ITrackStore> dereferenceAction;
private readonly TextureStore textureStore;
private readonly ITrackStore trackStore;
public BeatmapManagerWorkingBeatmap(IResourceStore<byte[]> store, TextureStore textureStore, ITrackStore trackStore, BeatmapInfo beatmapInfo, AudioManager audioManager,
Action<ITrackStore> dereferenceAction)
public BeatmapManagerWorkingBeatmap(IResourceStore<byte[]> store, TextureStore textureStore, ITrackStore trackStore, BeatmapInfo beatmapInfo, AudioManager audioManager)
: base(beatmapInfo, audioManager)
{
this.store = store;
this.dereferenceAction = dereferenceAction;
TextureStore = textureStore;
TrackStore = trackStore;
this.textureStore = textureStore;
this.trackStore = trackStore;
}
protected override IBeatmap GetBeatmap()
@ -61,7 +56,7 @@ namespace osu.Game.Beatmaps
try
{
return TextureStore.Get(getPathForFile(Metadata.BackgroundFile));
return textureStore.Get(getPathForFile(Metadata.BackgroundFile));
}
catch (Exception e)
{
@ -74,7 +69,7 @@ namespace osu.Game.Beatmaps
{
try
{
return TrackStore.Get(getPathForFile(Metadata.AudioFile));
return trackStore.Get(getPathForFile(Metadata.AudioFile));
}
catch (Exception e)
{
@ -140,11 +135,6 @@ namespace osu.Game.Beatmaps
return null;
}
}
~BeatmapManagerWorkingBeatmap()
{
dereferenceAction?.Invoke(TrackStore);
}
}
}
}