Share one context per file store for performance reasons

There is now a CreateContext method for retrieving a stand-alone context for threaded use.

We may want to add safety against this context being disposed (or just return a fresh one if it is).
This commit is contained in:
Dean Herbert
2017-10-23 16:35:35 +09:00
parent 4a68dd88cb
commit df20845fbb
5 changed files with 26 additions and 13 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -51,7 +52,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance
restoreButton.Enabled.Value = false;
Task.Run(() =>
{
foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden))
foreach (var b in beatmaps.QueryBeatmaps(b => b.Hidden).ToList())
beatmaps.Restore(b);
}).ContinueWith(t => Schedule(() => restoreButton.Enabled.Value = true));
}