From: Atsushi Kanamori Date: Wed, 8 Mar 2017 08:23:30 +0000 (-0800) Subject: Move two sharable classes into the shared partition. (dotnet/coreclr#10009) X-Git-Tag: submit/tizen/20210909.063632~11030^2~7810 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7228f57632899eb73a8d6ac9f8abd0d54fd4039;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Move two sharable classes into the shared partition. (dotnet/coreclr#10009) The corert side of this was commited by https://github.com/dotnet/corert/pull/2915#event-990346611 Commit migrated from https://github.com/dotnet/coreclr/commit/fe28e4034928d4d2daa3144de8d14013d18af468 --- diff --git a/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleMinusOneIsInvalid.cs b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleMinusOneIsInvalid.cs new file mode 100644 index 0000000..a76c51d --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleMinusOneIsInvalid.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ + // Class of critical handle which uses only -1 as an invalid handle. + public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle + { + protected CriticalHandleMinusOneIsInvalid() + : base(new IntPtr(-1)) + { + } + + public override bool IsInvalid => handle == new IntPtr(-1); + } +} diff --git a/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs new file mode 100644 index 0000000..195e48d --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/Microsoft/Win32/SafeHandles/CriticalHandleZeroOrMinusOneIsInvalid.cs @@ -0,0 +1,20 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.InteropServices; + +namespace Microsoft.Win32.SafeHandles +{ + // Class of critical handle which uses 0 or -1 as an invalid handle. + public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle + { + protected CriticalHandleZeroOrMinusOneIsInvalid() + : base(IntPtr.Zero) + { + } + + public override bool IsInvalid => handle.IsNull() || handle == new IntPtr(-1); + } +} diff --git a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems index e2a8291..0d1670f 100644 --- a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -178,6 +178,8 @@ + + diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs index 80c8deb..8a7f591 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs @@ -57,30 +57,4 @@ namespace Microsoft.Win32.SafeHandles get { return handle == new IntPtr(-1); } } } - - // Class of critical handle which uses 0 or -1 as an invalid handle. - public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle - { - protected CriticalHandleZeroOrMinusOneIsInvalid() : base(IntPtr.Zero) - { - } - - public override bool IsInvalid - { - get { return handle.IsNull() || handle == new IntPtr(-1); } - } - } - - // Class of critical handle which uses only -1 as an invalid handle. - public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle - { - protected CriticalHandleMinusOneIsInvalid() : base(new IntPtr(-1)) - { - } - - public override bool IsInvalid - { - get { return handle == new IntPtr(-1); } - } - } }