Files
cefsharp/CefSharp/Internals/LegacyJavaScriptObjectCache.cs
T
Alex Maitland d613e2c232 Apply suggestions from code review
Co-authored-by: campersau <buchholz.bastian@googlemail.com>
2025-10-11 11:39:34 +10:00

46 lines
1.2 KiB
C#

// Copyright © 2023 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.Collections.Generic;
namespace CefSharp.Internals
{
/// <summary>
/// Render Process JavaScript Binding (JSB) object cache
/// Legacy Behaviour, objects are cache per process.
/// </summary>
public class LegacyJavaScriptObjectCache : IJavaScriptObjectCache
{
private readonly Dictionary<string, JavascriptObject> cache
= new Dictionary<string, JavascriptObject>();
/// <inheritdoc/>
public void ClearCache(int browserId)
{
// NO OP
}
/// <inheritdoc/>
public void InsertOrUpdate(int browserId, IList<JavascriptObject> javascriptObjects)
{
foreach (var obj in javascriptObjects)
{
cache[obj.Name] = obj;
}
}
/// <inheritdoc/>
public ICollection<JavascriptObject> GetCacheValues(int browserId)
{
return cache.Values;
}
/// <inheritdoc/>
public Dictionary<string, JavascriptObject> GetCache(int browserId)
{
return cache;
}
}
}