com.wallstop-studios.dxmessaging 2.2.0 → 3.1.0

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.
Files changed (270) hide show
  1. package/CHANGELOG.md +315 -67
  2. package/CHANGELOG.md.meta +7 -7
  3. package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
  4. package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
  5. package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
  6. package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
  7. package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
  8. package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
  9. package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
  10. package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
  11. package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
  12. package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
  13. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1129 -0
  14. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
  15. package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
  16. package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
  17. package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
  18. package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
  19. package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
  20. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  21. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +46 -0
  22. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  23. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
  24. package/Editor/Analyzers.meta +8 -8
  25. package/Editor/AssemblyInfo.cs.meta +11 -3
  26. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
  27. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
  28. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +429 -0
  29. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
  30. package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
  31. package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +11 -3
  32. package/Editor/CustomEditors.meta +2 -2
  33. package/Editor/DxMessagingEditorIdle.cs +62 -0
  34. package/Editor/DxMessagingEditorIdle.cs.meta +11 -0
  35. package/Editor/DxMessagingEditorInitializer.cs +112 -15
  36. package/Editor/DxMessagingEditorInitializer.cs.meta +11 -3
  37. package/Editor/DxMessagingEditorLog.cs +32 -0
  38. package/Editor/DxMessagingEditorLog.cs.meta +11 -0
  39. package/Editor/DxMessagingMenu.cs.meta +11 -11
  40. package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
  41. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +313 -0
  42. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
  43. package/Editor/Settings/DxMessagingSettings.cs +261 -11
  44. package/Editor/Settings/DxMessagingSettings.cs.meta +11 -3
  45. package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
  46. package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +11 -3
  47. package/Editor/Settings.meta +2 -2
  48. package/Editor/SetupCscRsp.cs +406 -39
  49. package/Editor/SetupCscRsp.cs.meta +11 -3
  50. package/Editor/Testing/MessagingComponentEditorHarness.cs +2 -2
  51. package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +11 -3
  52. package/Editor/Testing.meta +3 -3
  53. package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
  54. package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
  55. package/Editor.meta +8 -8
  56. package/LICENSE.md +9 -9
  57. package/LICENSE.md.meta +7 -7
  58. package/README.md +940 -900
  59. package/README.md.meta +7 -7
  60. package/Runtime/AssemblyInfo.cs +4 -0
  61. package/Runtime/AssemblyInfo.cs.meta +11 -3
  62. package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +11 -3
  63. package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +11 -3
  64. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
  65. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
  66. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +2 -4
  67. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +11 -3
  68. package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +11 -3
  69. package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +11 -3
  70. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs +56 -0
  71. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs.meta +11 -0
  72. package/Runtime/Core/Attributes.meta +2 -2
  73. package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
  74. package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
  75. package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
  76. package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
  77. package/Runtime/Core/Configuration.meta +9 -0
  78. package/Runtime/Core/DataStructure/CyclicBuffer.cs +46 -28
  79. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +11 -3
  80. package/Runtime/Core/DataStructure.meta +2 -2
  81. package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +11 -3
  82. package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +11 -3
  83. package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +11 -3
  84. package/Runtime/Core/Diagnostics.meta +2 -2
  85. package/Runtime/Core/DxMessagingStaticState.cs +19 -0
  86. package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
  87. package/Runtime/Core/Extensions/EnumExtensions.cs +6 -5
  88. package/Runtime/Core/Extensions/EnumExtensions.cs.meta +11 -3
  89. package/Runtime/Core/Extensions/IListExtensions.cs.meta +11 -3
  90. package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
  91. package/Runtime/Core/Extensions/MessageExtensions.cs +0 -60
  92. package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
  93. package/Runtime/Core/Extensions.meta +8 -8
  94. package/Runtime/Core/Helper/MessageCache.cs +32 -0
  95. package/Runtime/Core/Helper/MessageCache.cs.meta +11 -3
  96. package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +11 -3
  97. package/Runtime/Core/Helper.meta +2 -2
  98. package/Runtime/Core/IMessage.cs +3 -3
  99. package/Runtime/Core/IMessage.cs.meta +11 -11
  100. package/Runtime/Core/InstanceId.cs +25 -1
  101. package/Runtime/Core/InstanceId.cs.meta +11 -11
  102. package/Runtime/Core/Internal/DxUnsafe.cs +60 -0
  103. package/Runtime/Core/Internal/DxUnsafe.cs.meta +11 -0
  104. package/Runtime/Core/Internal/FlatDispatch.cs +198 -0
  105. package/Runtime/Core/Internal/FlatDispatch.cs.meta +11 -0
  106. package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
  107. package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
  108. package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
  109. package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
  110. package/Runtime/Core/Internal/TypedSlots.cs +597 -0
  111. package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
  112. package/Runtime/Core/Internal.meta +9 -0
  113. package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
  114. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
  115. package/Runtime/Core/MessageBus/IMessageBus.cs +189 -15
  116. package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
  117. package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
  118. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +1 -0
  119. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
  120. package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
  121. package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
  122. package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
  123. package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
  124. package/Runtime/Core/MessageBus/Internal/BusSlots.cs +719 -0
  125. package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
  126. package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
  127. package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
  128. package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
  129. package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
  130. package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
  131. package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
  132. package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
  133. package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
  134. package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
  135. package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
  136. package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
  137. package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
  138. package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
  139. package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
  140. package/Runtime/Core/MessageBus/Internal.meta +9 -0
  141. package/Runtime/Core/MessageBus/MessageBus.cs +5366 -3838
  142. package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
  143. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
  144. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +187 -14
  145. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
  146. package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
  147. package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
  148. package/Runtime/Core/MessageBus.meta +8 -8
  149. package/Runtime/Core/MessageHandler.cs +2399 -1042
  150. package/Runtime/Core/MessageHandler.cs.meta +11 -11
  151. package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
  152. package/Runtime/Core/MessageRegistrationToken.cs +429 -44
  153. package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
  154. package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +11 -3
  155. package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
  156. package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
  157. package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
  158. package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +11 -3
  159. package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
  160. package/Runtime/Core/Messages/StringMessage.cs.meta +11 -3
  161. package/Runtime/Core/Messages.meta +8 -8
  162. package/Runtime/Core/MessagingDebug.cs.meta +11 -11
  163. package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
  164. package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
  165. package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
  166. package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
  167. package/Runtime/Core/Pooling/DxPools.cs +157 -0
  168. package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
  169. package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
  170. package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
  171. package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
  172. package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
  173. package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
  174. package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
  175. package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
  176. package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
  177. package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
  178. package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
  179. package/Runtime/Core/Pooling.meta +9 -0
  180. package/Runtime/Core.meta +8 -8
  181. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
  182. package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
  183. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
  184. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +11 -3
  185. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
  186. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
  187. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
  188. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
  189. package/Runtime/Unity/Integrations/Reflex.meta +8 -8
  190. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +11 -3
  191. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
  192. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
  193. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
  194. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
  195. package/Runtime/Unity/Integrations/VContainer.meta +8 -8
  196. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +11 -3
  197. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
  198. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
  199. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
  200. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
  201. package/Runtime/Unity/Integrations/Zenject.meta +8 -8
  202. package/Runtime/Unity/Integrations.meta +8 -8
  203. package/Runtime/Unity/MessageAwareComponent.cs +74 -0
  204. package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
  205. package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
  206. package/Runtime/Unity/MessagingComponent.cs +43 -10
  207. package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
  208. package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
  209. package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
  210. package/Runtime/Unity.meta +8 -8
  211. package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
  212. package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
  213. package/Runtime.meta +8 -8
  214. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
  215. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
  216. package/Samples~/DI/Prefabs.meta +8 -8
  217. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
  218. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
  219. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
  220. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
  221. package/Samples~/DI/Providers.meta +8 -8
  222. package/Samples~/DI/README.md +51 -51
  223. package/Samples~/DI/README.md.meta +7 -7
  224. package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
  225. package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
  226. package/Samples~/DI/Reflex.meta +8 -8
  227. package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
  228. package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
  229. package/Samples~/DI/VContainer.meta +8 -8
  230. package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
  231. package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
  232. package/Samples~/DI/Zenject.meta +8 -8
  233. package/Samples~/DI.meta +8 -8
  234. package/Samples~/Mini Combat/Boot.cs.meta +11 -11
  235. package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
  236. package/Samples~/Mini Combat/Messages.cs.meta +11 -11
  237. package/Samples~/Mini Combat/Player.cs.meta +11 -11
  238. package/Samples~/Mini Combat/README.md +324 -323
  239. package/Samples~/Mini Combat/README.md.meta +7 -7
  240. package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
  241. package/Samples~/Mini Combat/Walkthrough.md +430 -430
  242. package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
  243. package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
  244. package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
  245. package/Samples~/Mini Combat.meta +8 -8
  246. package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
  247. package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
  248. package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
  249. package/Samples~/UI Buttons + Inspector/README.md +210 -209
  250. package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
  251. package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
  252. package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
  253. package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
  254. package/Samples~/UI Buttons + Inspector.meta +8 -8
  255. package/SourceGenerators/Directory.Build.props +50 -3
  256. package/SourceGenerators/Directory.Build.props.meta +7 -7
  257. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs +96 -63
  258. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
  259. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs +745 -87
  260. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +11 -3
  261. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +39 -46
  262. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
  263. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
  264. package/SourceGenerators/global.json +7 -0
  265. package/SourceGenerators/global.json.meta +7 -0
  266. package/SourceGenerators.meta +8 -8
  267. package/Third Party Notices.md +3 -3
  268. package/Third Party Notices.md.meta +7 -7
  269. package/package.json +102 -92
  270. package/package.json.meta +7 -7
@@ -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,11 @@
1
- fileFormatVersion: 2
2
- guid: f9a83f6bf3c0487f9e5cff498dbb6932
3
- timeCreated: 1745161955
1
+ fileFormatVersion: 2
2
+ guid: f9a83f6bf3c0487f9e5cff498dbb6932
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: 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,11 @@
1
- fileFormatVersion: 2
2
- guid: cf8206ca4c8449a8b8e112ad25554f1f
3
- timeCreated: 1745161457
1
+ fileFormatVersion: 2
2
+ guid: cf8206ca4c8449a8b8e112ad25554f1f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -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,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 61e4386511c8d9d20ab1c8be9cf95805
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,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
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 852381a5e8ddb842edb761718afc1f9f
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,157 @@
1
+ namespace DxMessaging.Core.Pooling
2
+ {
3
+ using System.Collections.Generic;
4
+ using DxMessaging.Core.Internal;
5
+ #if UNITY_2021_3_OR_NEWER
6
+ using Configuration;
7
+ #endif
8
+
9
+ /// <summary>
10
+ /// Static, single-threaded pool registry shared by the bus and handler
11
+ /// subsystems. Instantiated lazily on first use; reconfigured by
12
+ /// <see cref="Configure"/> when the runtime settings asset changes.
13
+ /// </summary>
14
+ /// <remarks>
15
+ /// Each pool returns the per-entry recycle action that clears the entry
16
+ /// before re-use, so callers do not need to remember to <c>Clear()</c>
17
+ /// before <c>Return</c>. <c>OnEvicted</c> currently does nothing -- entries
18
+ /// are dropped on cap overflow and the GC reclaims them.
19
+ /// </remarks>
20
+ internal static class DxPools
21
+ {
22
+ // Mirrors DxMessagingRuntimeSettings.DefaultBufferMaxDistinctEntries; updated by Configure().
23
+ // Kept as a local constant so DxPools' field initializers don't depend on Unity types.
24
+ private const int DefaultMaxRetained = 512;
25
+
26
+ internal static readonly CollectionPool<Dictionary<InstanceId, object>> InstanceIdDicts =
27
+ new(
28
+ maxRetained: DefaultMaxRetained,
29
+ useLru: true,
30
+ factory: () => new Dictionary<InstanceId, object>(),
31
+ onRecycled: dict => dict.Clear()
32
+ );
33
+
34
+ internal static readonly CollectionPool<List<InstanceId>> InstanceIdLists = new(
35
+ maxRetained: DefaultMaxRetained,
36
+ useLru: true,
37
+ factory: () => new List<InstanceId>(),
38
+ onRecycled: list => list.Clear()
39
+ );
40
+
41
+ internal static readonly CollectionPool<HashSet<InstanceId>> InstanceIdSets = new(
42
+ maxRetained: DefaultMaxRetained,
43
+ useLru: true,
44
+ factory: () => new HashSet<InstanceId>(),
45
+ onRecycled: set => set.Clear()
46
+ );
47
+
48
+ internal static readonly CollectionPool<List<object>> ObjectLists = new(
49
+ maxRetained: DefaultMaxRetained,
50
+ useLru: true,
51
+ factory: () => new List<object>(),
52
+ onRecycled: list => list.Clear()
53
+ );
54
+
55
+ internal static readonly CollectionPool<Stack<object>> ObjectStacks = new(
56
+ maxRetained: DefaultMaxRetained,
57
+ useLru: true,
58
+ factory: () => new Stack<object>(),
59
+ onRecycled: stack => stack.Clear()
60
+ );
61
+
62
+ internal static readonly CollectionPool<HashSet<int>> IntSets = new(
63
+ maxRetained: DefaultMaxRetained,
64
+ useLru: true,
65
+ factory: () => new HashSet<int>(),
66
+ onRecycled: set => set.Clear()
67
+ );
68
+
69
+ internal static readonly CollectionPool<
70
+ Dictionary<InstanceId, Dictionary<int, IHandlerActionCache>>
71
+ > TypedHandlerContextDicts = new(
72
+ maxRetained: DefaultMaxRetained,
73
+ useLru: true,
74
+ factory: () => new Dictionary<InstanceId, Dictionary<int, IHandlerActionCache>>(),
75
+ onRecycled: dict => dict.Clear()
76
+ );
77
+
78
+ internal static readonly CollectionPool<
79
+ Dictionary<int, IHandlerActionCache>
80
+ > TypedHandlerPriorityDicts = new(
81
+ maxRetained: DefaultMaxRetained,
82
+ useLru: true,
83
+ factory: () => new Dictionary<int, IHandlerActionCache>(),
84
+ onRecycled: dict => dict.Clear()
85
+ );
86
+
87
+ /// <summary>
88
+ /// Trim every pool. <paramref name="force"/> drains pools to zero;
89
+ /// otherwise each pool is trimmed to its current cap (a no-op unless the
90
+ /// cap was lowered). Returns total evicted count.
91
+ /// </summary>
92
+ internal static int TrimAll(bool force)
93
+ {
94
+ int evicted = 0;
95
+ evicted += InstanceIdDicts.Trim(force ? 0 : InstanceIdDicts.MaxRetained);
96
+ evicted += InstanceIdLists.Trim(force ? 0 : InstanceIdLists.MaxRetained);
97
+ evicted += InstanceIdSets.Trim(force ? 0 : InstanceIdSets.MaxRetained);
98
+ evicted += ObjectLists.Trim(force ? 0 : ObjectLists.MaxRetained);
99
+ evicted += ObjectStacks.Trim(force ? 0 : ObjectStacks.MaxRetained);
100
+ evicted += IntSets.Trim(force ? 0 : IntSets.MaxRetained);
101
+ evicted += TypedHandlerContextDicts.Trim(
102
+ force ? 0 : TypedHandlerContextDicts.MaxRetained
103
+ );
104
+ evicted += TypedHandlerPriorityDicts.Trim(
105
+ force ? 0 : TypedHandlerPriorityDicts.MaxRetained
106
+ );
107
+ return evicted;
108
+ }
109
+
110
+ #if UNITY_2021_3_OR_NEWER
111
+ /// <summary>
112
+ /// Re-apply caps from the supplied settings. Lowering a cap immediately
113
+ /// trims; raising a cap takes effect on subsequent returns.
114
+ /// </summary>
115
+ internal static void Configure(DxMessagingRuntimeSettings settings)
116
+ {
117
+ if (settings == null)
118
+ {
119
+ throw new System.ArgumentNullException(nameof(settings));
120
+ }
121
+ int cap = settings.BufferMaxDistinctEntries;
122
+ bool useLru = settings.BufferUseLruEviction;
123
+ InstanceIdDicts.UseLru = useLru;
124
+ InstanceIdLists.UseLru = useLru;
125
+ InstanceIdSets.UseLru = useLru;
126
+ ObjectLists.UseLru = useLru;
127
+ ObjectStacks.UseLru = useLru;
128
+ IntSets.UseLru = useLru;
129
+ TypedHandlerContextDicts.UseLru = useLru;
130
+ TypedHandlerPriorityDicts.UseLru = useLru;
131
+ InstanceIdDicts.MaxRetained = cap;
132
+ InstanceIdLists.MaxRetained = cap;
133
+ InstanceIdSets.MaxRetained = cap;
134
+ ObjectLists.MaxRetained = cap;
135
+ ObjectStacks.MaxRetained = cap;
136
+ IntSets.MaxRetained = cap;
137
+ TypedHandlerContextDicts.MaxRetained = cap;
138
+ TypedHandlerPriorityDicts.MaxRetained = cap;
139
+ }
140
+ #endif
141
+
142
+ /// <summary>Aggregate snapshot of every pool's diagnostics.</summary>
143
+ internal static PoolDiagnosticsSnapshot DescribeAll()
144
+ {
145
+ return new PoolDiagnosticsSnapshot(
146
+ InstanceIdDicts.Snapshot(),
147
+ InstanceIdLists.Snapshot(),
148
+ InstanceIdSets.Snapshot(),
149
+ ObjectLists.Snapshot(),
150
+ ObjectStacks.Snapshot(),
151
+ IntSets.Snapshot(),
152
+ TypedHandlerContextDicts.Snapshot(),
153
+ TypedHandlerPriorityDicts.Snapshot()
154
+ );
155
+ }
156
+ }
157
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c15b462050f33ab6fd3c588a3cec8943
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: