Make DtrBar more threadsafe (#1978)

* Changed DtrBar to use ReaderWriterLockSlim so that there exists only one storage of entries, preventing possible desync.
* DtrBarEntry will now hold a reference to the LocalPlugin that created the entry, so that DtrBarPluginScoped can defer plugin related handling to the main service.
* Marked DtrBarEntry class itself to be turned internal in API 11.
* Made IDtrBar.Entries return an immutable copy of underlying list of DtrBar entries, that will be freshly created whenever the list changes.
This commit is contained in:
srkizer 2024-07-28 21:14:37 +09:00 committed by GitHub
parent a7ab3b9def
commit c25f13261d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 385 additions and 207 deletions

View file

@ -1,29 +0,0 @@
namespace Dalamud.Utility;
/// <summary>
/// Utility class for marking something to be changed for API 10, for ease of lookup.
/// </summary>
[AttributeUsage(AttributeTargets.All, Inherited = false)]
internal sealed class Api10ToDoAttribute : Attribute
{
/// <summary>
/// Marks that this exists purely for making API 9 plugins work.
/// </summary>
public const string DeleteCompatBehavior = "Delete. This is for making API 9 plugins work.";
/// <summary>
/// Marks that this should be moved to an another namespace.
/// </summary>
public const string MoveNamespace = "Move to another namespace.";
/// <summary>
/// Initializes a new instance of the <see cref="Api10ToDoAttribute"/> class.
/// </summary>
/// <param name="what">The explanation.</param>
/// <param name="what2">The explanation 2.</param>
public Api10ToDoAttribute(string what, string what2 = "")
{
_ = what;
_ = what2;
}
}

View file

@ -0,0 +1,24 @@
namespace Dalamud.Utility;
/// <summary>
/// Utility class for marking something to be changed for API 11, for ease of lookup.
/// </summary>
[AttributeUsage(AttributeTargets.All, Inherited = false)]
internal sealed class Api11ToDoAttribute : Attribute
{
/// <summary>
/// Marks that this should be made internal.
/// </summary>
public const string MakeInternal = "Make internal.";
/// <summary>
/// Initializes a new instance of the <see cref="Api11ToDoAttribute"/> class.
/// </summary>
/// <param name="what">The explanation.</param>
/// <param name="what2">The explanation 2.</param>
public Api11ToDoAttribute(string what, string what2 = "")
{
_ = what;
_ = what2;
}
}