Commit e3cfd6ef authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

shell32: Remove class cache introduced in commit f686cfab.

parent 260a949f
......@@ -50,28 +50,6 @@
WINE_DEFAULT_DEBUG_CHANNEL (shell);
static CRITICAL_SECTION SHELL32_SF_ClassCacheCS;
static CRITICAL_SECTION_DEBUG critsect_debug =
{
0, 0, &SHELL32_SF_ClassCacheCS,
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
0, 0, { (DWORD_PTR)(__FILE__ ": SHELL32_SF_ClassCacheCS") }
};
static CRITICAL_SECTION SHELL32_SF_ClassCacheCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/* IShellFolder class cache */
struct _sf_cls_cache_entry
{
CLSID clsid;
LPVOID pv;
};
static struct _sf_class_cache
{
DWORD allocated, used;
struct _sf_cls_cache_entry *sf_cls_cache_entry;
} sf_cls_cache;
static const WCHAR wszDotShellClassInfo[] = {
'.','S','h','e','l','l','C','l','a','s','s','I','n','f','o',0};
......@@ -204,70 +182,6 @@ HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc,
return hr;
}
static BOOL get_iface_from_cache(REFCLSID clsid, LPVOID *ppvOut)
{
BOOL ret = FALSE;
int i;
EnterCriticalSection(&SHELL32_SF_ClassCacheCS);
for (i = 0; i < sf_cls_cache.used; i++)
{
if (IsEqualIID(&sf_cls_cache.sf_cls_cache_entry[i].clsid, clsid))
{
*ppvOut = sf_cls_cache.sf_cls_cache_entry[i].pv;
/* Pin it */
IUnknown_AddRef((IUnknown *)*ppvOut);
ret = TRUE;
break;
}
}
LeaveCriticalSection(&SHELL32_SF_ClassCacheCS);
return ret;
}
static void add_iface_to_cache(REFCLSID clsid, LPVOID pv)
{
EnterCriticalSection(&SHELL32_SF_ClassCacheCS);
if (sf_cls_cache.used >= sf_cls_cache.allocated)
{
DWORD allocated;
struct _sf_cls_cache_entry *sf_cls_cache_entry;
if (!sf_cls_cache.allocated)
{
allocated = 4;
sf_cls_cache_entry = HeapAlloc(GetProcessHeap(), 0,
4 * sizeof(*sf_cls_cache_entry));
}
else
{
allocated = sf_cls_cache.allocated * 2;
sf_cls_cache_entry = HeapReAlloc(GetProcessHeap(), 0, sf_cls_cache.sf_cls_cache_entry,
allocated * sizeof(*sf_cls_cache_entry));
}
if (!sf_cls_cache_entry)
{
LeaveCriticalSection(&SHELL32_SF_ClassCacheCS);
return;
}
sf_cls_cache.allocated = allocated;
sf_cls_cache.sf_cls_cache_entry = sf_cls_cache_entry;
}
/* Pin it */
IUnknown_AddRef((IUnknown *)pv);
sf_cls_cache.sf_cls_cache_entry[sf_cls_cache.used].clsid = *clsid;
sf_cls_cache.sf_cls_cache_entry[sf_cls_cache.used].pv = pv;
sf_cls_cache.used++;
LeaveCriticalSection(&SHELL32_SF_ClassCacheCS);
}
/***********************************************************************
* SHELL32_CoCreateInitSF
*
......@@ -281,22 +195,11 @@ static void add_iface_to_cache(REFCLSID clsid, LPVOID pv)
static HRESULT SHELL32_CoCreateInitSF (LPCITEMIDLIST pidlRoot, LPCWSTR pathRoot,
LPCITEMIDLIST pidlChild, REFCLSID clsid, LPVOID * ppvOut)
{
HRESULT hr = S_OK;
HRESULT hr;
TRACE ("%p %s %p\n", pidlRoot, debugstr_w(pathRoot), pidlChild);
if (!get_iface_from_cache(clsid, ppvOut))
{
hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IShellFolder, ppvOut);
if (SUCCEEDED(hr))
{
TRACE("loaded %p %s\n", *ppvOut, wine_dbgstr_guid(clsid));
add_iface_to_cache(clsid, *ppvOut);
}
}
else
TRACE("found in the cache %p %s\n", *ppvOut, wine_dbgstr_guid(clsid));
hr = SHCoCreateInstance(NULL, clsid, NULL, &IID_IShellFolder, ppvOut);
if (SUCCEEDED (hr))
{
LPITEMIDLIST pidlAbsolute = ILCombine (pidlRoot, pidlChild);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment