// Copyright © 2015 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System; using System.Collections.Concurrent; using System.Threading.Tasks; namespace CefSharp.Internals { internal sealed class FramePendingTaskRepository : IDisposable { public ConcurrentDictionary> PendingTasks { get; } = new ConcurrentDictionary>(); public ConcurrentDictionary> CallbackPendingTasks { get; } = new ConcurrentDictionary>(); public void Dispose() { foreach (var tcs in PendingTasks.Values) { tcs.TrySetCanceled(); } PendingTasks.Clear(); foreach (var tcs in CallbackPendingTasks.Values) { tcs.TrySetCanceled(); } CallbackPendingTasks.Clear(); } } }