Skip to content

Commit

Permalink
Remove internal Pair type in favor of generic tuples (#9916)
Browse files Browse the repository at this point in the history
  • Loading branch information
h3xds1nz authored Dec 19, 2024
1 parent 3e62119 commit 99d03c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<Compile Include="$(WpfSharedDir)\MS\Internal\FreezableOperations.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\PointUtil.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\MimeTypeMapper.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\Pair.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\PartialList.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\LegacyPriorityQueue.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\SequentialUshortCollection.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,14 +735,10 @@ private void SendPresent(object sender, EventArgs args)
/// </summary>
private object SetIsFrontBufferAvailable(object isAvailableVersionPair)
{
Pair pair = (Pair)isAvailableVersionPair;
uint version = (uint)pair.Second;
(bool isFrontBufferAvailable, uint version) = (Tuple<bool, uint>)isAvailableVersionPair;

if (version == _version)
{
bool isFrontBufferAvailable = (bool)pair.First;
if (_version == version)
SetValue(IsFrontBufferAvailablePropertyKey, isFrontBufferAvailable);
}

// ...just because DispatcherOperationCallback requires returning an object
return null;
Expand All @@ -759,11 +755,9 @@ private object SetIsFrontBufferAvailable(object isAvailableVersionPair)
// NOTE: Called from the render thread!We must execute the reaction on the UI thread.
private void Callback(bool isFrontBufferAvailable, uint version)
{
Dispatcher.BeginInvoke(
DispatcherPriority.Normal,
new DispatcherOperationCallback(SetIsFrontBufferAvailable),
new Pair(BooleanBoxes.Box(isFrontBufferAvailable), version)
);
Tuple<bool, uint> parameters = new(isFrontBufferAvailable, version);

Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(SetIsFrontBufferAvailable), parameters);
}

internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
Expand Down
53 changes: 0 additions & 53 deletions src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Pair.cs

This file was deleted.

0 comments on commit 99d03c8

Please sign in to comment.