Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1129 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(dw ThreadId); | 1129 std::map<DWORD,CPluginClass*>::const_iterator it = s_threadInstances.find(dw ThreadId); |
1130 if (it != s_threadInstances.end()) | 1130 if (it != s_threadInstances.end()) |
1131 { | 1131 { |
1132 tab = it->second->m_tab; | 1132 tab = it->second->m_tab; |
1133 } | 1133 } |
1134 } | 1134 } |
1135 s_criticalSectionLocal.Unlock(); | 1135 s_criticalSectionLocal.Unlock(); |
1136 | 1136 |
1137 return tab; | 1137 return tab; |
1138 } | 1138 } |
1139 | 1139 |
Eric
2014/10/08 17:37:54
I'm mildly concerned that this version of GetTab i
sergei
2014/10/09 13:46:22
I think it should be fast enough with linear searc
| |
1140 CPluginTab* CPluginClass::GetTab(const std::wstring& url) | 1140 CPluginTab* CPluginClass::GetTab(const std::wstring& url) |
1141 { | 1141 { |
1142 CPluginTab* tab = NULL; | 1142 CPluginTab* tab = NULL; |
1143 | 1143 |
1144 s_criticalSectionLocal.Lock(); | 1144 s_criticalSectionLocal.Lock(); |
1145 { | 1145 { |
1146 std::map<DWORD,CPluginClass*>::const_iterator it; | 1146 std::map<DWORD,CPluginClass*>::const_iterator it; |
1147 for (it = s_threadInstances.begin(); it != s_threadInstances.end(); it++) | 1147 for (it = s_threadInstances.begin(); it != s_threadInstances.end(); ++it) |
Eric
2014/10/08 17:37:54
We can use the range-for syntax here. It's support
| |
1148 { | 1148 { |
1149 if (it->second->GetBrowserUrl() == url.c_str()) | 1149 if (it->second->GetBrowserUrl() == url.c_str()) |
1150 { | 1150 { |
1151 s_criticalSectionLocal.Unlock(); | |
1151 return it->second->m_tab; | 1152 return it->second->m_tab; |
Eric
2014/10/08 17:37:54
If we were using a sentry object to control the mu
sergei
2014/10/09 13:46:22
+1 for scoped lock
I also don't like return if it'
| |
1152 } | 1153 } |
1153 } | 1154 } |
1154 } | 1155 } |
1155 s_criticalSectionLocal.Unlock(); | 1156 s_criticalSectionLocal.Unlock(); |
1156 | 1157 |
1157 return tab; | 1158 return tab; |
1158 } | 1159 } |
1159 | 1160 |
1160 | 1161 |
1161 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) | 1162 STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, O LECMD prgCmds[], OLECMDTEXT* pCmdText) |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2021 } | 2022 } |
2022 } | 2023 } |
2023 } | 2024 } |
2024 | 2025 |
2025 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 2026 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
2026 } | 2027 } |
2027 | 2028 |
2028 return hTabWnd; | 2029 return hTabWnd; |
2029 | 2030 |
2030 } | 2031 } |
LEFT | RIGHT |