Improve xmldoc

This commit is contained in:
Dean Herbert 2020-05-13 11:09:17 +09:00
parent a86c7f478c
commit bbf4c687a8

View File

@ -768,18 +768,19 @@ namespace osu.Game
private Task asyncLoadStream; private Task asyncLoadStream;
/// <summary> /// <summary>
/// Schedules loading the provided <paramref name="d"/> in a single file. /// Queues loading the provided component in sequential fashion.
/// This operation is limited to a single thread to avoid saturating all cores.
/// </summary> /// </summary>
/// <param name="d">The component to load.</param> /// <param name="component">The component to load.</param>
/// <param name="add">The method to invoke for adding the component.</param> /// <param name="loadCompleteAction">An action to invoke on load completion (generally to add the component to the hierarchy).</param>
/// <param name="cache">Whether to cache the component as type <typeparamref name="T"/> into the game dependencies before any scheduling.</param> /// <param name="cache">Whether to cache the component as type <typeparamref name="T"/> into the game dependencies before any scheduling.</param>
private T loadComponentSingleFile<T>(T d, Action<T> add, bool cache = false) private T loadComponentSingleFile<T>(T component, Action<T> loadCompleteAction, bool cache = false)
where T : Drawable where T : Drawable
{ {
if (cache) if (cache)
dependencies.CacheAs(d); dependencies.CacheAs(component);
if (d is OverlayContainer overlay) if (component is OverlayContainer overlay)
overlays.Add(overlay); overlays.Add(overlay);
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
@ -797,12 +798,12 @@ namespace osu.Game
try try
{ {
Logger.Log($"Loading {d}...", level: LogLevel.Debug); Logger.Log($"Loading {component}...", level: LogLevel.Debug);
// Since this is running in a separate thread, it is possible for OsuGame to be disposed after LoadComponentAsync has been called // Since this is running in a separate thread, it is possible for OsuGame to be disposed after LoadComponentAsync has been called
// throwing an exception. To avoid this, the call is scheduled on the update thread, which does not run if IsDisposed = true // throwing an exception. To avoid this, the call is scheduled on the update thread, which does not run if IsDisposed = true
Task task = null; Task task = null;
var del = new ScheduledDelegate(() => task = LoadComponentAsync(d, add)); var del = new ScheduledDelegate(() => task = LoadComponentAsync(component, loadCompleteAction));
Scheduler.Add(del); Scheduler.Add(del);
// The delegate won't complete if OsuGame has been disposed in the meantime // The delegate won't complete if OsuGame has been disposed in the meantime
@ -817,7 +818,7 @@ namespace osu.Game
await task; await task;
Logger.Log($"Loaded {d}!", level: LogLevel.Debug); Logger.Log($"Loaded {component}!", level: LogLevel.Debug);
} }
catch (OperationCanceledException) catch (OperationCanceledException)
{ {
@ -825,7 +826,7 @@ namespace osu.Game
}); });
}); });
return d; return component;
} }
protected override bool OnScroll(ScrollEvent e) protected override bool OnScroll(ScrollEvent e)