// Copyright © 2020 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.Threading; namespace CefSharp.Internals { /// /// Browser Ref counter /// Used internally to keep track of open browser instances /// The ref count is incremented when a browser is created, /// and decremented when the browser has successfully closed. /// public interface IBrowserRefCounter : IDisposable { /// /// Increment browser count /// /// Browser type, used for logging internally void Increment(Type type); /// /// Decrement browser count /// /// Browser type, used for logging internally /// returns true if the count is 0, otherwise false bool Decrement(Type type); /// /// Gets the number of CefBrowser instances currently open (this includes popups) /// /// /// The count. /// int Count { get; } /// /// Enable logging /// void EnableLogging(); /// /// Gets the log (empty if not enabled). /// /// string string GetLog(); /// /// Blocks until the CefBrowser count has reached 0 or the timeout has been reached /// /// (Optional) The timeout in miliseconds. void WaitForBrowsersToClose(int timeoutInMiliseconds = 500); /// /// Blocks until the CefBrowser count has reached 0 or the timeout has been reached /// /// (Optional) The timeout in miliseconds. /// (Optional) The cancellation token. void WaitForBrowsersToClose(int timeoutInMiliseconds, CancellationToken cancellationToken); } }