aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs
diff options
context:
space:
mode:
authorjhorv <38920027+jhorv@users.noreply.github.com>2024-08-05 20:09:08 -0400
committerGitHub <noreply@github.com>2024-08-05 21:09:08 -0300
commit7969fb6bbaf49a7a84df379d072b94286e4f7ada (patch)
treec5fdb45a7929601e217fb180f2678c449e3dc23b /src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs
parent4a4b11871e362016b41c56d4dd4654ade0b894e0 (diff)
Replace and remove obsolete ByteMemoryPool type (#7155)
* refactor: replace usage of ByteMemoryPool with MemoryOwner<byte> * refactor: delete unused ByteMemoryPool and ByteMemoryPool.ByteMemoryPoolBuffer types * refactor: change IMemoryOwner<byte> return types to MemoryOwner<byte> * fix(perf): get span via `MemoryOwner<T>.Span` directly instead of `MemoryOwner<T>.Memory.Span` * fix(perf): get span via MemoryOwner<T>.Span directly instead of `MemoryOwner<T>.Memory.Span` * fix(perf): get span via MemoryOwner<T>.Span directly instead of `MemoryOwner<T>.Memory.Span`
Diffstat (limited to 'src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs')
-rw-r--r--src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs b/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs
deleted file mode 100644
index 05fb29ac..00000000
--- a/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using System;
-using System.Buffers;
-using System.Threading;
-
-namespace Ryujinx.Common.Memory
-{
- public partial class ByteMemoryPool
- {
- /// <summary>
- /// Represents a <see cref="IMemoryOwner{Byte}"/> that wraps an array rented from
- /// <see cref="ArrayPool{Byte}.Shared"/> and exposes it as <see cref="Memory{Byte}"/>
- /// with a length of the requested size.
- /// </summary>
- private sealed class ByteMemoryPoolBuffer : IMemoryOwner<byte>
- {
- private byte[] _array;
- private readonly int _length;
-
- public ByteMemoryPoolBuffer(int length)
- {
- _array = ArrayPool<byte>.Shared.Rent(length);
- _length = length;
- }
-
- /// <summary>
- /// Returns a <see cref="Memory{Byte}"/> belonging to this owner.
- /// </summary>
- public Memory<byte> Memory
- {
- get
- {
- byte[] array = _array;
-
- ObjectDisposedException.ThrowIf(array is null, this);
-
- return new Memory<byte>(array, 0, _length);
- }
- }
-
- public void Dispose()
- {
- var array = Interlocked.Exchange(ref _array, null);
-
- if (array != null)
- {
- ArrayPool<byte>.Shared.Return(array);
- }
- }
- }
- }
-}