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

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 5712621990838272: [IE] Replace ATL::CSimpleArray (Closed)
Patch Set: Created July 20, 2014, 5:36 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginClass.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClass.h" 3 #include "PluginClass.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #include "PluginSystem.h" 5 #include "PluginSystem.h"
6 #ifdef SUPPORT_FILTER 6 #ifdef SUPPORT_FILTER
7 #include "PluginFilter.h" 7 #include "PluginFilter.h"
8 #endif 8 #endif
9 #include "PluginMimeFilterClient.h" 9 #include "PluginMimeFilterClient.h"
10 #include "PluginClient.h" 10 #include "PluginClient.h"
(...skipping 18 matching lines...) Expand all
29 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED }; 29 DWORD CPluginClass::s_hIconTypes[ICON_MAX] = { IDI_ICON_DISABLED, IDI_ICON_ENABL ED, IDI_ICON_DEACTIVATED };
30 30
31 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL; 31 CPluginMimeFilterClient* CPluginClass::s_mimeFilter = NULL;
32 32
33 CLOSETHEMEDATA pfnClose = NULL; 33 CLOSETHEMEDATA pfnClose = NULL;
34 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL; 34 DRAWTHEMEBACKGROUND pfnDrawThemeBackground = NULL;
35 OPENTHEMEDATA pfnOpenThemeData = NULL; 35 OPENTHEMEDATA pfnOpenThemeData = NULL;
36 36
37 ATOM CPluginClass::s_atomPaneClass = NULL; 37 ATOM CPluginClass::s_atomPaneClass = NULL;
38 HINSTANCE CPluginClass::s_hUxtheme = NULL; 38 HINSTANCE CPluginClass::s_hUxtheme = NULL;
39 CSimpleArray<CPluginClass*> CPluginClass::s_instances; 39 std::set<CPluginClass*> CPluginClass::s_instances;
40 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; 40 std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances;
41 41
42 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; 42 CComAutoCriticalSection CPluginClass::s_criticalSectionLocal;
43 CComAutoCriticalSection CPluginClass::s_criticalSectionBrowser; 43 CComAutoCriticalSection CPluginClass::s_criticalSectionBrowser;
44 CComAutoCriticalSection CPluginClass::s_criticalSectionWindow; 44 CComAutoCriticalSection CPluginClass::s_criticalSectionWindow;
45 45
46 CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2; 46 CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2;
47 47
48 #ifdef SUPPORT_WHITELIST 48 #ifdef SUPPORT_WHITELIST
49 std::map<UINT,CString> CPluginClass::s_menuDomains; 49 std::map<UINT,CString> CPluginClass::s_menuDomains;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 //register the mimefilter 255 //register the mimefilter
256 //and only mimefilter 256 //and only mimefilter
257 //on some few computers the mimefilter does not get properly registered when it is done on another thread 257 //on some few computers the mimefilter does not get properly registered when it is done on another thread
258 258
259 s_criticalSectionLocal.Lock(); 259 s_criticalSectionLocal.Lock();
260 { 260 {
261 // Always register on startup, then check if we need to unregister in a se parate thread 261 // Always register on startup, then check if we need to unregister in a se parate thread
262 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); 262 s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance();
263 s_asyncWebBrowser2 = unknownSite; 263 s_asyncWebBrowser2 = unknownSite;
264 s_instances.Add(this); 264 s_instances.insert( this );
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
265 } 265 }
266 s_criticalSectionLocal.Unlock(); 266 s_criticalSectionLocal.Unlock();
267 267
268 try 268 try
269 { 269 {
270 // Check if loaded as BHO 270 // Check if loaded as BHO
271 if (GetBrowser()) 271 if (GetBrowser())
272 { 272 {
273 DEBUG_GENERAL("Loaded as BHO"); 273 DEBUG_GENERAL("Loaded as BHO");
274 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); 274 CComPtr<IConnectionPoint> pPoint = GetConnectionPoint();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 358
359 m_hTabWnd = NULL; 359 m_hTabWnd = NULL;
360 m_hStatusBarWnd = NULL; 360 m_hStatusBarWnd = NULL;
361 361
362 // Remove instance from the list, shutdown threads 362 // Remove instance from the list, shutdown threads
363 HANDLE hMainThread = NULL; 363 HANDLE hMainThread = NULL;
364 HANDLE hTabThread = NULL; 364 HANDLE hTabThread = NULL;
365 365
366 s_criticalSectionLocal.Lock(); 366 s_criticalSectionLocal.Lock();
367 { 367 {
368 s_instances.Remove(this); 368 s_instances.erase(this);
369 369
370 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC urrentThreadId()); 370 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC urrentThreadId());
371 if (it != s_threadInstances.end()) 371 if (it != s_threadInstances.end())
372 { 372 {
373 s_threadInstances.erase(it); 373 s_threadInstances.erase(it);
374 } 374 }
375 if (s_instances.GetSize() == 0) 375 if ( s_instances.empty() )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
376 { 376 {
377 CPluginClientFactory::ReleaseMimeFilterClientInstance(); 377 CPluginClientFactory::ReleaseMimeFilterClientInstance();
378 } 378 }
379 } 379 }
380 s_criticalSectionLocal.Unlock(); 380 s_criticalSectionLocal.Unlock();
381 381
382 // Release browser interface 382 // Release browser interface
383 s_criticalSectionBrowser.Lock(); 383 s_criticalSectionBrowser.Lock();
384 { 384 {
385 m_webBrowser2.Release(); 385 m_webBrowser2.Release();
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 if (hTabWnd2) 886 if (hTabWnd2)
887 { 887 {
888 DWORD nProcessId; 888 DWORD nProcessId;
889 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); 889 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId);
890 if (::GetCurrentProcessId() == nProcessId) 890 if (::GetCurrentProcessId() == nProcessId)
891 { 891 {
892 bool bExistingTab = false; 892 bool bExistingTab = false;
893 893
894 s_criticalSectionLocal.Lock(); 894 s_criticalSectionLocal.Lock();
895 { 895 {
896 for (int i = 0; i < s_instances.GetSize(); i++) 896 for ( auto instance : s_instances )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
897 { 897 {
898 if (s_instances[i]->m_hTabWnd == hTabWnd2) 898 if ( instance->m_hTabWnd == hTabWnd2)
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '('
899 { 899 {
900 900
901 bExistingTab = true; 901 bExistingTab = true;
902 break; 902 break;
903 } 903 }
904 } 904 }
905 } 905 }
906 s_criticalSectionLocal.Unlock(); 906 s_criticalSectionLocal.Unlock();
907 907
908 if (!bExistingTab) 908 if (!bExistingTab)
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 m_hTheme = pfnOpenThemeData(m_hPaneWnd, L"STATUS"); 1055 m_hTheme = pfnOpenThemeData(m_hPaneWnd, L"STATUS");
1056 if (!m_hTheme) 1056 if (!m_hTheme)
1057 { 1057 {
1058 } 1058 }
1059 } 1059 }
1060 } 1060 }
1061 1061
1062 1062
1063 CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd) 1063 CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd)
1064 { 1064 {
1065 CPluginClass* instance = NULL; 1065 CPluginClass* return_instance = NULL;
sergei 2014/07/21 08:49:51 According to the coding style it should be `nullpt
1066 1066
1067 s_criticalSectionLocal.Lock(); 1067 s_criticalSectionLocal.Lock();
1068 { 1068 {
1069 for (int i = 0; i < s_instances.GetSize(); i++) 1069 for ( auto instance : s_instances )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
1070 { 1070 {
1071 if (s_instances[i]->m_hStatusBarWnd == hStatusBarWnd) 1071 if ( instance->m_hStatusBarWnd == hStatusBarWnd)
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '('
1072 { 1072 {
1073 instance = s_instances[i]; 1073 return_instance = instance;
1074 break; 1074 break;
1075 } 1075 }
1076 } 1076 }
1077 } 1077 }
1078 s_criticalSectionLocal.Unlock(); 1078 s_criticalSectionLocal.Unlock();
1079 1079
1080 return instance; 1080 return return_instance;
1081 } 1081 }
1082 1082
1083 CPluginTab* CPluginClass::GetTab() 1083 CPluginTab* CPluginClass::GetTab()
1084 { 1084 {
1085 return m_tab; 1085 return m_tab;
1086 } 1086 }
1087 1087
1088 CPluginTab* CPluginClass::GetTab(DWORD dwThreadId) 1088 CPluginTab* CPluginClass::GetTab(DWORD dwThreadId)
1089 { 1089 {
1090 CPluginTab* tab = NULL; 1090 CPluginTab* tab = NULL;
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 if (hTabWnd2) 1942 if (hTabWnd2)
1943 { 1943 {
1944 DWORD nProcessId; 1944 DWORD nProcessId;
1945 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId); 1945 ::GetWindowThreadProcessId(hTabWnd2, &nProcessId);
1946 if (::GetCurrentProcessId() == nProcessId) 1946 if (::GetCurrentProcessId() == nProcessId)
1947 { 1947 {
1948 bool bExistingTab = false; 1948 bool bExistingTab = false;
1949 s_criticalSectionLocal.Lock(); 1949 s_criticalSectionLocal.Lock();
1950 1950
1951 { 1951 {
1952 for (int i = 0; i < s_instances.GetSize(); i++) 1952 for ( auto instance : s_instances )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
1953 { 1953 {
1954 if (s_instances[i]->m_hTabWnd == hTabWnd2) 1954 if ( instance->m_hTabWnd == hTabWnd2 )
Oleksandr 2014/07/21 09:00:54 Style nit: no space after '(' and before ')'
1955 { 1955 {
1956 bExistingTab = true; 1956 bExistingTab = true;
1957 break; 1957 break;
1958 } 1958 }
1959 } 1959 }
1960 } 1960 }
1961 1961
1962 if (!bExistingTab) 1962 if (!bExistingTab)
1963 { 1963 {
1964 hBrowserWnd = hTabWnd2; 1964 hBrowserWnd = hTabWnd2;
1965 hTabWnd = hTabWnd2; 1965 hTabWnd = hTabWnd2;
1966 s_criticalSectionLocal.Unlock(); 1966 s_criticalSectionLocal.Unlock();
1967 break; 1967 break;
1968 } 1968 }
1969 s_criticalSectionLocal.Unlock(); 1969 s_criticalSectionLocal.Unlock();
1970 1970
1971 } 1971 }
1972 } 1972 }
1973 } 1973 }
1974 1974
1975 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1975 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1976 } 1976 }
1977 1977
1978 return hTabWnd; 1978 return hTabWnd;
1979 1979
1980 } 1980 }
OLDNEW
« 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