mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 00:47:20 +08:00
Merge pull request #11944 from peppy/remove-working-beatmap-finalizer
Remove WorkingBeatmap's finalizer
This commit is contained in:
commit
d5798533c4
@ -20,6 +20,7 @@ using osu.Framework.IO.Stores;
|
|||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
|
using osu.Framework.Statistics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -311,6 +312,9 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
workingCache.Add(working = new BeatmapManagerWorkingBeatmap(beatmapInfo, this));
|
workingCache.Add(working = new BeatmapManagerWorkingBeatmap(beatmapInfo, this));
|
||||||
|
|
||||||
|
// best effort; may be higher than expected.
|
||||||
|
GlobalStatistics.Get<int>(nameof(Beatmaps), $"Cached {nameof(WorkingBeatmap)}s").Value = workingCache.Count();
|
||||||
|
|
||||||
return working;
|
return working;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,6 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Statistics;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -34,8 +33,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected AudioManager AudioManager { get; }
|
protected AudioManager AudioManager { get; }
|
||||||
|
|
||||||
private static readonly GlobalStatistic<int> total_count = GlobalStatistics.Get<int>(nameof(Beatmaps), $"Total {nameof(WorkingBeatmap)}s");
|
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||||
{
|
{
|
||||||
AudioManager = audioManager;
|
AudioManager = audioManager;
|
||||||
@ -47,8 +44,6 @@ namespace osu.Game.Beatmaps
|
|||||||
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
||||||
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
||||||
skin = new RecyclableLazy<ISkin>(GetSkin);
|
skin = new RecyclableLazy<ISkin>(GetSkin);
|
||||||
|
|
||||||
total_count.Value++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Track GetVirtualTrack(double emptyLength = 0)
|
protected virtual Track GetVirtualTrack(double emptyLength = 0)
|
||||||
@ -331,11 +326,6 @@ namespace osu.Game.Beatmaps
|
|||||||
protected virtual ISkin GetSkin() => new DefaultSkin();
|
protected virtual ISkin GetSkin() => new DefaultSkin();
|
||||||
private readonly RecyclableLazy<ISkin> skin;
|
private readonly RecyclableLazy<ISkin> skin;
|
||||||
|
|
||||||
~WorkingBeatmap()
|
|
||||||
{
|
|
||||||
total_count.Value--;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RecyclableLazy<T>
|
public class RecyclableLazy<T>
|
||||||
{
|
{
|
||||||
private Lazy<T> lazy;
|
private Lazy<T> lazy;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user