Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/plugin/PluginClass.cpp

Issue 5712621990838272: [IE] Replace ATL::CSimpleArray (Closed)
Patch Set: Created July 24, 2014, 12:31 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/plugin/PluginClass.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -36,7 +36,7 @@
ATOM CPluginClass::s_atomPaneClass = NULL;
HINSTANCE CPluginClass::s_hUxtheme = NULL;
-CSimpleArray<CPluginClass*> CPluginClass::s_instances;
+std::set<CPluginClass*> CPluginClass::s_instances;
std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances;
CComAutoCriticalSection CPluginClass::s_criticalSectionLocal;
@@ -285,7 +285,7 @@
// Always register on startup, then check if we need to unregister in a separate thread
s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
s_asyncWebBrowser2 = unknownSite;
- s_instances.Add(this);
+ s_instances.insert(this);
}
s_criticalSectionLocal.Unlock();
@@ -389,14 +389,14 @@
s_criticalSectionLocal.Lock();
{
- s_instances.Remove(this);
+ s_instances.erase(this);
std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetCurrentThreadId());
if (it != s_threadInstances.end())
{
s_threadInstances.erase(it);
}
- if (s_instances.GetSize() == 0)
+ if (s_instances.empty())
{
CPluginClientFactory::ReleaseMimeFilterClientInstance();
}
@@ -917,11 +917,10 @@
s_criticalSectionLocal.Lock();
{
- for (int i = 0; i < s_instances.GetSize(); i++)
+ for (auto instance : s_instances)
{
- if (s_instances[i]->m_hTabWnd == hTabWnd2)
+ if (instance->m_hTabWnd == hTabWnd2)
{
-
bExistingTab = true;
break;
}
@@ -1086,22 +1085,22 @@
CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd)
{
- CPluginClass* instance = NULL;
+ CPluginClass* result = nullptr;
s_criticalSectionLocal.Lock();
{
- for (int i = 0; i < s_instances.GetSize(); i++)
+ for (auto instance : s_instances)
{
- if (s_instances[i]->m_hStatusBarWnd == hStatusBarWnd)
+ if (instance->m_hStatusBarWnd == hStatusBarWnd)
{
- instance = s_instances[i];
+ result = instance;
break;
}
}
}
s_criticalSectionLocal.Unlock();
- return instance;
+ return result;
}
CPluginTab* CPluginClass::GetTab()
@@ -1973,9 +1972,9 @@
s_criticalSectionLocal.Lock();
{
- for (int i = 0; i < s_instances.GetSize(); i++)
+ for (auto instance : s_instances)
{
- if (s_instances[i]->m_hTabWnd == hTabWnd2)
+ if (instance->m_hTabWnd == hTabWnd2)
{
bExistingTab = true;
break;
« no previous file with comments | « src/plugin/PluginClass.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld