29 lines
639 B
C#
29 lines
639 B
C#
using System;
|
|
using System.Buffers;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace Microsoft.AspNetCore.SignalR.Internal.Protocol
|
|
{
|
|
internal class JsonArrayPool<T> : IArrayPool<T>
|
|
{
|
|
private readonly ArrayPool<T> _inner;
|
|
|
|
internal static readonly JsonArrayPool<T> Shared = new JsonArrayPool<T>(ArrayPool<T>.Shared);
|
|
|
|
public JsonArrayPool(ArrayPool<T> inner)
|
|
{
|
|
_inner = inner;
|
|
}
|
|
|
|
public T[] Rent(int minimumLength)
|
|
{
|
|
return _inner.Rent(minimumLength);
|
|
}
|
|
|
|
public void Return(T[] array)
|
|
{
|
|
_inner.Return(array);
|
|
}
|
|
}
|
|
}
|