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 20, 2014, 5:36 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;
@@ -261,7 +261,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 );
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
}
s_criticalSectionLocal.Unlock();
@@ -365,14 +365,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() )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
{
CPluginClientFactory::ReleaseMimeFilterClientInstance();
}
@@ -893,9 +893,9 @@
s_criticalSectionLocal.Lock();
{
- for (int i = 0; i < s_instances.GetSize(); i++)
+ for ( auto instance : s_instances )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
{
- if (s_instances[i]->m_hTabWnd == hTabWnd2)
+ if ( instance->m_hTabWnd == hTabWnd2)
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '('
{
bExistingTab = true;
@@ -1062,22 +1062,22 @@
CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd)
{
- CPluginClass* instance = NULL;
+ CPluginClass* return_instance = NULL;
sergei 2014/07/21 08:49:51 According to the coding style it should be `nullpt
s_criticalSectionLocal.Lock();
{
- for (int i = 0; i < s_instances.GetSize(); i++)
+ for ( auto instance : s_instances )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
{
- if (s_instances[i]->m_hStatusBarWnd == hStatusBarWnd)
+ if ( instance->m_hStatusBarWnd == hStatusBarWnd)
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '('
{
- instance = s_instances[i];
+ return_instance = instance;
break;
}
}
}
s_criticalSectionLocal.Unlock();
- return instance;
+ return return_instance;
}
CPluginTab* CPluginClass::GetTab()
@@ -1949,9 +1949,9 @@
s_criticalSectionLocal.Lock();
{
- for (int i = 0; i < s_instances.GetSize(); i++)
+ for ( auto instance : s_instances )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
{
- if (s_instances[i]->m_hTabWnd == hTabWnd2)
+ if ( instance->m_hTabWnd == hTabWnd2 )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
{
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