com.wallstop-studios.dxmessaging 2.1.9 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +106 -65
- package/CHANGELOG.md.meta +7 -7
- package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
- package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1122 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
- package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
- package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
- package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
- package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +33 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
- package/Editor/Analyzers.meta +8 -8
- package/Editor/AssemblyInfo.cs.meta +3 -3
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +420 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
- package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
- package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +2 -2
- package/Editor/CustomEditors.meta +2 -2
- package/Editor/DxMessagingEditorInitializer.cs +1 -1
- package/Editor/DxMessagingEditorInitializer.cs.meta +2 -2
- package/Editor/DxMessagingMenu.cs.meta +11 -11
- package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +190 -0
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
- package/Editor/Settings/DxMessagingSettings.cs +189 -0
- package/Editor/Settings/DxMessagingSettings.cs.meta +2 -2
- package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
- package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +2 -2
- package/Editor/Settings.meta +2 -2
- package/Editor/SetupCscRsp.cs +209 -8
- package/Editor/SetupCscRsp.cs.meta +2 -2
- package/Editor/Testing/MessagingComponentEditorHarness.cs +1 -1
- package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +3 -3
- package/Editor/Testing.meta +3 -3
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
- package/Editor.meta +8 -8
- package/LICENSE.md +9 -9
- package/LICENSE.md.meta +7 -7
- package/README.md +941 -900
- package/README.md.meta +7 -7
- package/Runtime/AssemblyInfo.cs +4 -0
- package/Runtime/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +2 -2
- package/Runtime/Core/Attributes.meta +2 -2
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
- package/Runtime/Core/Configuration.meta +9 -0
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +2 -2
- package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +2 -2
- package/Runtime/Core/DataStructure.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +2 -2
- package/Runtime/Core/Diagnostics.meta +2 -2
- package/Runtime/Core/DxMessagingStaticState.cs +19 -0
- package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
- package/Runtime/Core/Extensions/EnumExtensions.cs.meta +2 -2
- package/Runtime/Core/Extensions/IListExtensions.cs.meta +2 -2
- package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
- package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
- package/Runtime/Core/Extensions.meta +8 -8
- package/Runtime/Core/Helper/MessageCache.cs +32 -0
- package/Runtime/Core/Helper/MessageCache.cs.meta +2 -2
- package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +2 -2
- package/Runtime/Core/Helper.meta +2 -2
- package/Runtime/Core/IMessage.cs +3 -3
- package/Runtime/Core/IMessage.cs.meta +11 -11
- package/Runtime/Core/InstanceId.cs.meta +11 -11
- package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs +51 -0
- package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlots.cs +613 -0
- package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
- package/Runtime/Core/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
- package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBus.cs +177 -3
- package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs +718 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/MessageBus.cs +2651 -500
- package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
- package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
- package/Runtime/Core/MessageBus.meta +8 -8
- package/Runtime/Core/MessageHandler.cs +2019 -542
- package/Runtime/Core/MessageHandler.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationToken.cs +7 -0
- package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
- package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +2 -2
- package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +2 -2
- package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/StringMessage.cs.meta +2 -2
- package/Runtime/Core/Messages.meta +8 -8
- package/Runtime/Core/MessagingDebug.cs.meta +11 -11
- package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
- package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
- package/Runtime/Core/Pooling/DxPools.cs +157 -0
- package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
- package/Runtime/Core/Pooling.meta +9 -0
- package/Runtime/Core.meta +8 -8
- package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
- package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Reflex.meta +8 -8
- package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/VContainer.meta +8 -8
- package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +2 -2
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Zenject.meta +8 -8
- package/Runtime/Unity/Integrations.meta +8 -8
- package/Runtime/Unity/MessageAwareComponent.cs +29 -0
- package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
- package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
- package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
- package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
- package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity.meta +8 -8
- package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
- package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
- package/Runtime.meta +8 -8
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
- package/Samples~/DI/Prefabs.meta +8 -8
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers.meta +8 -8
- package/Samples~/DI/README.md +51 -51
- package/Samples~/DI/README.md.meta +7 -7
- package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
- package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Reflex.meta +8 -8
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
- package/Samples~/DI/VContainer.meta +8 -8
- package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
- package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Zenject.meta +8 -8
- package/Samples~/DI.meta +8 -8
- package/Samples~/Mini Combat/Boot.cs.meta +11 -11
- package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
- package/Samples~/Mini Combat/Messages.cs.meta +11 -11
- package/Samples~/Mini Combat/Player.cs.meta +11 -11
- package/Samples~/Mini Combat/README.md +324 -323
- package/Samples~/Mini Combat/README.md.meta +7 -7
- package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
- package/Samples~/Mini Combat/Walkthrough.md +430 -430
- package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
- package/Samples~/Mini Combat.meta +8 -8
- package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/README.md +210 -209
- package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
- package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
- package/Samples~/UI Buttons + Inspector.meta +8 -8
- package/SourceGenerators/Directory.Build.props.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +2 -2
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
- package/SourceGenerators.meta +8 -8
- package/Third Party Notices.md +3 -3
- package/Third Party Notices.md.meta +7 -7
- package/package.json +115 -92
- package/package.json.meta +7 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: a1f4dd001abc18c4cafd24fa6e778268
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: a1f4dd001abc18c4cafd24fa6e778268
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 9df8c16d3cffca545b374ec4cb1d5cad
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 9df8c16d3cffca545b374ec4cb1d5cad
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1977,6 +1977,13 @@ namespace DxMessaging.Core
|
|
|
1977
1977
|
{
|
|
1978
1978
|
deregistrationAction?.Invoke();
|
|
1979
1979
|
}
|
|
1980
|
+
|
|
1981
|
+
// Drop the matching staged registration and metadata so a later
|
|
1982
|
+
// Disable()/Enable() cycle does not silently re-register the
|
|
1983
|
+
// handler we were just asked to remove.
|
|
1984
|
+
_ = _registrations?.Remove(handle);
|
|
1985
|
+
_ = _metadata?.Remove(handle);
|
|
1986
|
+
_ = _callCounts?.Remove(handle);
|
|
1980
1987
|
}
|
|
1981
1988
|
|
|
1982
1989
|
/// <summary>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: d5dce65290c6c424b870b19b6353e6b1
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: d5dce65290c6c424b870b19b6353e6b1
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 58b2b780f9844aeb8929eeca855ba3be
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 58b2b780f9844aeb8929eeca855ba3be
|
|
3
3
|
timeCreated: 1745161506
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: ef4b123d67e3bcd4a8ebe2f18b3acbf9
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: ef4b123d67e3bcd4a8ebe2f18b3acbf9
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 5b82bbdd13cb3654aafba14e0c21ca52
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 5b82bbdd13cb3654aafba14e0c21ca52
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 0a0789976ef004e4c926d5f25bd92e50
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 0a0789976ef004e4c926d5f25bd92e50
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: f9a83f6bf3c0487f9e5cff498dbb6932
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: f9a83f6bf3c0487f9e5cff498dbb6932
|
|
3
3
|
timeCreated: 1745161955
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: f5b6176a6924a364dbc509e1db5b30f4
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: f5b6176a6924a364dbc509e1db5b30f4
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: cf8206ca4c8449a8b8e112ad25554f1f
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: cf8206ca4c8449a8b8e112ad25554f1f
|
|
3
3
|
timeCreated: 1745161457
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: eb7aa358315732945a9f45ad92904b2f
|
|
3
|
-
folderAsset: yes
|
|
4
|
-
DefaultImporter:
|
|
5
|
-
externalObjects: {}
|
|
6
|
-
userData:
|
|
7
|
-
assetBundleName:
|
|
8
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: eb7aa358315732945a9f45ad92904b2f
|
|
3
|
+
folderAsset: yes
|
|
4
|
+
DefaultImporter:
|
|
5
|
+
externalObjects: {}
|
|
6
|
+
userData:
|
|
7
|
+
assetBundleName:
|
|
8
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 95f160b63321b69489108cdf413b55d2
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 95f160b63321b69489108cdf413b55d2
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
namespace DxMessaging.Core.Pooling
|
|
2
|
+
{
|
|
3
|
+
using System;
|
|
4
|
+
using System.Collections.Generic;
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Single-threaded object pool with bounded capacity and either LRU or LIFO
|
|
8
|
+
/// recycle order. Used by <see cref="DxPools"/> to recycle the dictionaries,
|
|
9
|
+
/// lists, sets, and stacks that DxMessaging slots rent and return on slot
|
|
10
|
+
/// reset. Not thread-safe by design -- the entire dispatch path is single-
|
|
11
|
+
/// threaded.
|
|
12
|
+
/// </summary>
|
|
13
|
+
/// <remarks>
|
|
14
|
+
/// Adapted from https://github.com/wallstop/unity-helpers/blob/de22dcd22fd98d4fe8c7aa8e70814496698681f7/Runtime/Utils/Buffers.cs
|
|
15
|
+
/// (single-threaded portion only -- the unity-helpers version supports
|
|
16
|
+
/// thread-static caches we do not need here).
|
|
17
|
+
/// </remarks>
|
|
18
|
+
internal sealed class CollectionPool<T>
|
|
19
|
+
where T : class, new()
|
|
20
|
+
{
|
|
21
|
+
private readonly Func<T> _factory;
|
|
22
|
+
private readonly Action<T> _onRecycled; // called once when a returned entry is accepted into the pool
|
|
23
|
+
private readonly Action<T> _onEvicted; // called when an entry is dropped (cap overflow or trim)
|
|
24
|
+
private bool _useLru;
|
|
25
|
+
private int _maxRetained;
|
|
26
|
+
|
|
27
|
+
// LRU state -- Queue<T> is FIFO with O(1) Enqueue/Dequeue (amortized)
|
|
28
|
+
// and avoids the per-node allocation that LinkedList incurs.
|
|
29
|
+
private readonly Queue<T> _lruQueue;
|
|
30
|
+
private readonly HashSet<T> _lruMembership;
|
|
31
|
+
|
|
32
|
+
// LIFO state
|
|
33
|
+
private readonly Stack<T> _stack;
|
|
34
|
+
private readonly HashSet<T> _stackMembership;
|
|
35
|
+
|
|
36
|
+
private readonly int _ownerThreadId = Environment.CurrentManagedThreadId;
|
|
37
|
+
|
|
38
|
+
private long _hits;
|
|
39
|
+
private long _misses;
|
|
40
|
+
private long _evictions;
|
|
41
|
+
|
|
42
|
+
public CollectionPool(
|
|
43
|
+
int maxRetained,
|
|
44
|
+
bool useLru,
|
|
45
|
+
Func<T> factory,
|
|
46
|
+
Action<T> onRecycled = null,
|
|
47
|
+
Action<T> onEvicted = null
|
|
48
|
+
)
|
|
49
|
+
{
|
|
50
|
+
if (maxRetained < 0)
|
|
51
|
+
{
|
|
52
|
+
throw new ArgumentOutOfRangeException(nameof(maxRetained));
|
|
53
|
+
}
|
|
54
|
+
_maxRetained = maxRetained;
|
|
55
|
+
_useLru = useLru;
|
|
56
|
+
_factory = factory ?? throw new ArgumentNullException(nameof(factory));
|
|
57
|
+
_onRecycled = onRecycled;
|
|
58
|
+
_onEvicted = onEvicted;
|
|
59
|
+
int initialCapacity = Math.Min(maxRetained, 32);
|
|
60
|
+
_lruQueue = new Queue<T>(initialCapacity);
|
|
61
|
+
_lruMembership = new HashSet<T>();
|
|
62
|
+
_stack = new Stack<T>(initialCapacity);
|
|
63
|
+
_stackMembership = new HashSet<T>();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/// <summary>Current cached count.</summary>
|
|
67
|
+
public int Count => _useLru ? _lruQueue.Count : _stack.Count;
|
|
68
|
+
|
|
69
|
+
/// <summary>Whether this pool evicts oldest returned entries first.</summary>
|
|
70
|
+
public bool UseLru
|
|
71
|
+
{
|
|
72
|
+
get => _useLru;
|
|
73
|
+
set
|
|
74
|
+
{
|
|
75
|
+
AssertOwnerThread();
|
|
76
|
+
if (_useLru == value)
|
|
77
|
+
{
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (value)
|
|
81
|
+
{
|
|
82
|
+
ConvertStackToLru();
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
{
|
|
86
|
+
ConvertLruToStack();
|
|
87
|
+
}
|
|
88
|
+
_useLru = value;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/// <summary>Soft cap on retained entries. Mutating this may evict.</summary>
|
|
93
|
+
public int MaxRetained
|
|
94
|
+
{
|
|
95
|
+
get => _maxRetained;
|
|
96
|
+
set
|
|
97
|
+
{
|
|
98
|
+
AssertOwnerThread();
|
|
99
|
+
if (value < 0)
|
|
100
|
+
{
|
|
101
|
+
throw new ArgumentOutOfRangeException(nameof(value));
|
|
102
|
+
}
|
|
103
|
+
_maxRetained = value;
|
|
104
|
+
EvictDownTo(value);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public T Rent()
|
|
109
|
+
{
|
|
110
|
+
AssertOwnerThread();
|
|
111
|
+
if (_useLru)
|
|
112
|
+
{
|
|
113
|
+
if (_lruQueue.Count > 0)
|
|
114
|
+
{
|
|
115
|
+
T pooled = _lruQueue.Dequeue();
|
|
116
|
+
_lruMembership.Remove(pooled);
|
|
117
|
+
_hits++;
|
|
118
|
+
return pooled;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (_stack.Count > 0)
|
|
122
|
+
{
|
|
123
|
+
T pooled = _stack.Pop();
|
|
124
|
+
_stackMembership.Remove(pooled);
|
|
125
|
+
_hits++;
|
|
126
|
+
return pooled;
|
|
127
|
+
}
|
|
128
|
+
_misses++;
|
|
129
|
+
T fresh = _factory();
|
|
130
|
+
if (fresh == null)
|
|
131
|
+
{
|
|
132
|
+
throw new InvalidOperationException("CollectionPool factory returned null.");
|
|
133
|
+
}
|
|
134
|
+
return fresh;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public void Return(T value)
|
|
138
|
+
{
|
|
139
|
+
AssertOwnerThread();
|
|
140
|
+
if (value == null)
|
|
141
|
+
{
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (_maxRetained == 0)
|
|
145
|
+
{
|
|
146
|
+
_evictions++;
|
|
147
|
+
_onEvicted?.Invoke(value);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (_useLru)
|
|
151
|
+
{
|
|
152
|
+
if (_lruMembership.Contains(value))
|
|
153
|
+
{
|
|
154
|
+
return; // already pooled; ignore double-return
|
|
155
|
+
}
|
|
156
|
+
if (_lruQueue.Count >= _maxRetained)
|
|
157
|
+
{
|
|
158
|
+
T head = _lruQueue.Dequeue();
|
|
159
|
+
_lruMembership.Remove(head);
|
|
160
|
+
_evictions++;
|
|
161
|
+
_onEvicted?.Invoke(head);
|
|
162
|
+
}
|
|
163
|
+
_onRecycled?.Invoke(value);
|
|
164
|
+
_lruQueue.Enqueue(value);
|
|
165
|
+
_lruMembership.Add(value);
|
|
166
|
+
}
|
|
167
|
+
else
|
|
168
|
+
{
|
|
169
|
+
if (_stackMembership.Contains(value))
|
|
170
|
+
{
|
|
171
|
+
return; // already pooled; ignore double-return
|
|
172
|
+
}
|
|
173
|
+
if (_stack.Count >= _maxRetained)
|
|
174
|
+
{
|
|
175
|
+
_evictions++;
|
|
176
|
+
_onEvicted?.Invoke(value);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
_onRecycled?.Invoke(value);
|
|
180
|
+
_stack.Push(value);
|
|
181
|
+
_stackMembership.Add(value);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/// <summary>Trim the pool to <paramref name="targetSize"/>. Returns count evicted.</summary>
|
|
186
|
+
public int Trim(int targetSize)
|
|
187
|
+
{
|
|
188
|
+
AssertOwnerThread();
|
|
189
|
+
if (targetSize < 0)
|
|
190
|
+
{
|
|
191
|
+
targetSize = 0;
|
|
192
|
+
}
|
|
193
|
+
return EvictDownTo(targetSize);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
public CollectionPoolDiagnostics Snapshot()
|
|
197
|
+
{
|
|
198
|
+
return new CollectionPoolDiagnostics(Count, _hits, _misses, _evictions);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private int EvictDownTo(int targetSize)
|
|
202
|
+
{
|
|
203
|
+
int evicted = 0;
|
|
204
|
+
if (_useLru)
|
|
205
|
+
{
|
|
206
|
+
while (_lruQueue.Count > targetSize)
|
|
207
|
+
{
|
|
208
|
+
T head = _lruQueue.Dequeue();
|
|
209
|
+
_lruMembership.Remove(head);
|
|
210
|
+
_evictions++;
|
|
211
|
+
evicted++;
|
|
212
|
+
_onEvicted?.Invoke(head);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
else
|
|
216
|
+
{
|
|
217
|
+
while (_stack.Count > targetSize)
|
|
218
|
+
{
|
|
219
|
+
T item = _stack.Pop();
|
|
220
|
+
_stackMembership.Remove(item);
|
|
221
|
+
_evictions++;
|
|
222
|
+
evicted++;
|
|
223
|
+
_onEvicted?.Invoke(item);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return evicted;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private void ConvertLruToStack()
|
|
230
|
+
{
|
|
231
|
+
while (_lruQueue.Count > 0)
|
|
232
|
+
{
|
|
233
|
+
T item = _lruQueue.Dequeue();
|
|
234
|
+
_lruMembership.Remove(item);
|
|
235
|
+
_stack.Push(item);
|
|
236
|
+
_stackMembership.Add(item);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private void ConvertStackToLru()
|
|
241
|
+
{
|
|
242
|
+
T[] items = _stack.ToArray();
|
|
243
|
+
_stack.Clear();
|
|
244
|
+
_stackMembership.Clear();
|
|
245
|
+
for (int index = items.Length - 1; index >= 0; index--)
|
|
246
|
+
{
|
|
247
|
+
T item = items[index];
|
|
248
|
+
_lruQueue.Enqueue(item);
|
|
249
|
+
_lruMembership.Add(item);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
[System.Diagnostics.Conditional("DEBUG")]
|
|
254
|
+
private void AssertOwnerThread()
|
|
255
|
+
{
|
|
256
|
+
if (Environment.CurrentManagedThreadId != _ownerThreadId)
|
|
257
|
+
{
|
|
258
|
+
throw new InvalidOperationException(
|
|
259
|
+
"CollectionPool<"
|
|
260
|
+
+ typeof(T).Name
|
|
261
|
+
+ "> is single-threaded; accessed from foreign thread."
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
namespace DxMessaging.Core.Pooling
|
|
2
|
+
{
|
|
3
|
+
/// <summary>
|
|
4
|
+
/// Snapshot of a single pool's lifetime counters and current cached count.
|
|
5
|
+
/// All values are point-in-time; reading them does not reset the underlying
|
|
6
|
+
/// counters. Useful for leak-watcher style assertions and for debug overlays.
|
|
7
|
+
/// </summary>
|
|
8
|
+
internal readonly struct CollectionPoolDiagnostics
|
|
9
|
+
{
|
|
10
|
+
/// <summary>Number of entries currently retained by the pool.</summary>
|
|
11
|
+
public readonly int Cached;
|
|
12
|
+
|
|
13
|
+
/// <summary>Lifetime count of <c>Rent</c> calls that returned a pooled entry.</summary>
|
|
14
|
+
public readonly long Hits;
|
|
15
|
+
|
|
16
|
+
/// <summary>Lifetime count of <c>Rent</c> calls that allocated a fresh entry.</summary>
|
|
17
|
+
public readonly long Misses;
|
|
18
|
+
|
|
19
|
+
/// <summary>Lifetime count of pooled entries dropped due to cap or LRU eviction.</summary>
|
|
20
|
+
public readonly long Evictions;
|
|
21
|
+
|
|
22
|
+
internal CollectionPoolDiagnostics(int cached, long hits, long misses, long evictions)
|
|
23
|
+
{
|
|
24
|
+
Cached = cached;
|
|
25
|
+
Hits = hits;
|
|
26
|
+
Misses = misses;
|
|
27
|
+
Evictions = evictions;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|