From bdcea81f1b028f098187df9ce026f3cc8d892eb3 Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Sun, 9 Feb 2020 23:05:34 -0800 Subject: [PATCH] move ArrayBuffer to Common (#32002) * move ArrayBuffer to Common * remove old reference to ArrayBuffer.cs --- .../SocketsHttpHandler => Common/src/System/Net}/ArrayBuffer.cs | 3 ++- src/libraries/System.Net.Http/src/System.Net.Http.csproj | 6 ++++-- .../tests/UnitTests/System.Net.Http.Unit.Tests.csproj | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) rename src/libraries/{System.Net.Http/src/System/Net/Http/SocketsHttpHandler => Common/src/System/Net}/ArrayBuffer.cs (96%) diff --git a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ArrayBuffer.cs b/src/libraries/Common/src/System/Net/ArrayBuffer.cs similarity index 96% rename from src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ArrayBuffer.cs rename to src/libraries/Common/src/System/Net/ArrayBuffer.cs index 52cd2f4..3ed340e 100644 --- a/src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ArrayBuffer.cs +++ b/src/libraries/Common/src/System/Net/ArrayBuffer.cs @@ -6,7 +6,7 @@ using System.Buffers; using System.Diagnostics; using System.Runtime.InteropServices; -namespace System.Net.Http +namespace System.Net { // Warning: Mutable struct! // The purpose of this struct is to simplify buffer management. @@ -56,6 +56,7 @@ namespace System.Net.Http public int ActiveLength => _availableStart - _activeStart; public Span ActiveSpan => new Span(_bytes, _activeStart, _availableStart - _activeStart); + public ReadOnlySpan ActiveReadOnlySpan => new ReadOnlySpan(_bytes, _activeStart, _availableStart - _activeStart); public int AvailableLength => _bytes.Length - _availableStart; public Span AvailableSpan => new Span(_bytes, _availableStart, AvailableLength); public Memory ActiveMemory => new Memory(_bytes, _activeStart, _availableStart - _activeStart); diff --git a/src/libraries/System.Net.Http/src/System.Net.Http.csproj b/src/libraries/System.Net.Http/src/System.Net.Http.csproj index 2a8241d..08aa292 100644 --- a/src/libraries/System.Net.Http/src/System.Net.Http.csproj +++ b/src/libraries/System.Net.Http/src/System.Net.Http.csproj @@ -119,10 +119,12 @@ Common\System\Text\SimpleRegex.cs + + Common\System\Net\ArrayBuffer.cs + - @@ -747,4 +749,4 @@ - \ No newline at end of file + diff --git a/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj b/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj index 21d2011..dad493b 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj +++ b/src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj @@ -26,6 +26,9 @@ ProductionCode\Common\System\IO\StreamHelpers.CopyValidation.cs + + Common\System\Net\ArrayBuffer.cs + ProductionCode\Common\System\Net\InternalException.cs @@ -311,9 +314,6 @@ ProductionCode\System\Net\Http\StringContent.cs - - ProductionCode\System\Net\Http\SocketsHttpHandler\ArrayBuffer.cs - ProductionCode\System\Net\Http\SocketsHttpHandler\HttpEnvironmentProxy.cs @@ -532,4 +532,4 @@ WinHttpHandler\UnitTests\TestServer.cs - \ No newline at end of file + -- 2.7.4