mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Remove unused enumerator object pool from ObjectTable
This commit is contained in:
parent
daeb923f6d
commit
a1305159dc
1 changed files with 4 additions and 26 deletions
|
|
@ -7,8 +7,6 @@ using Dalamud.Game.ClientState.Objects.SubKinds;
|
||||||
using Dalamud.Game.ClientState.Objects.Types;
|
using Dalamud.Game.ClientState.Objects.Types;
|
||||||
using Dalamud.IoC;
|
using Dalamud.IoC;
|
||||||
using Dalamud.IoC.Internal;
|
using Dalamud.IoC.Internal;
|
||||||
using Dalamud.Logging.Internal;
|
|
||||||
using Dalamud.Plugin.Internal;
|
|
||||||
using Dalamud.Plugin.Services;
|
using Dalamud.Plugin.Services;
|
||||||
using Dalamud.Utility;
|
using Dalamud.Utility;
|
||||||
|
|
||||||
|
|
@ -31,20 +29,13 @@ namespace Dalamud.Game.ClientState.Objects;
|
||||||
#pragma warning restore SA1015
|
#pragma warning restore SA1015
|
||||||
internal sealed partial class ObjectTable : IServiceType, IObjectTable
|
internal sealed partial class ObjectTable : IServiceType, IObjectTable
|
||||||
{
|
{
|
||||||
private static readonly ModuleLog Log = new("ObjectTable");
|
|
||||||
|
|
||||||
private static int objectTableLength;
|
private static int objectTableLength;
|
||||||
|
|
||||||
private readonly ClientState clientState;
|
private readonly ClientState clientState;
|
||||||
private readonly CachedEntry[] cachedObjectTable;
|
private readonly CachedEntry[] cachedObjectTable;
|
||||||
|
|
||||||
private readonly ObjectPool<Enumerator> multiThreadedEnumerators =
|
|
||||||
new DefaultObjectPoolProvider().Create<Enumerator>();
|
|
||||||
|
|
||||||
private readonly Enumerator?[] frameworkThreadEnumerators = new Enumerator?[4];
|
private readonly Enumerator?[] frameworkThreadEnumerators = new Enumerator?[4];
|
||||||
|
|
||||||
private long nextMultithreadedUsageWarnTime;
|
|
||||||
|
|
||||||
[ServiceManager.ServiceConstructor]
|
[ServiceManager.ServiceConstructor]
|
||||||
private unsafe ObjectTable(ClientState clientState)
|
private unsafe ObjectTable(ClientState clientState)
|
||||||
{
|
{
|
||||||
|
|
@ -228,21 +219,12 @@ internal sealed partial class ObjectTable
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
|
||||||
|
|
||||||
private sealed class Enumerator : IEnumerator<IGameObject>, IResettable
|
private sealed class Enumerator(ObjectTable owner, int slotId) : IEnumerator<IGameObject>, IResettable
|
||||||
{
|
{
|
||||||
private readonly int slotId;
|
private ObjectTable? owner = owner;
|
||||||
private ObjectTable? owner;
|
|
||||||
|
|
||||||
private int index = -1;
|
private int index = -1;
|
||||||
|
|
||||||
public Enumerator() => this.slotId = -1;
|
|
||||||
|
|
||||||
public Enumerator(ObjectTable owner, int slotId)
|
|
||||||
{
|
|
||||||
this.owner = owner;
|
|
||||||
this.slotId = slotId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IGameObject Current { get; private set; } = null!;
|
public IGameObject Current { get; private set; } = null!;
|
||||||
|
|
||||||
object IEnumerator.Current => this.Current;
|
object IEnumerator.Current => this.Current;
|
||||||
|
|
@ -265,8 +247,6 @@ internal sealed partial class ObjectTable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitializeForPooledObjects(ObjectTable ot) => this.owner = ot;
|
|
||||||
|
|
||||||
public void Reset() => this.index = -1;
|
public void Reset() => this.index = -1;
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -274,10 +254,8 @@ internal sealed partial class ObjectTable
|
||||||
if (this.owner is not { } o)
|
if (this.owner is not { } o)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.slotId == -1)
|
if (slotId != -1)
|
||||||
o.multiThreadedEnumerators.Return(this);
|
o.frameworkThreadEnumerators[slotId] = this;
|
||||||
else
|
|
||||||
o.frameworkThreadEnumerators[this.slotId] = this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryReset()
|
public bool TryReset()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue