Index: src/plugin/PluginClass.cpp |
=================================================================== |
--- a/src/plugin/PluginClass.cpp |
+++ b/src/plugin/PluginClass.cpp |
@@ -1137,6 +1137,27 @@ |
return tab; |
} |
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
|
+CPluginTab* CPluginClass::GetTab(const std::wstring& url) |
+{ |
+ CPluginTab* tab = NULL; |
+ |
+ s_criticalSectionLocal.Lock(); |
+ { |
+ std::map<DWORD,CPluginClass*>::const_iterator it; |
+ 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
|
+ { |
+ if (it->second->GetBrowserUrl() == url.c_str()) |
+ { |
+ s_criticalSectionLocal.Unlock(); |
+ 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'
|
+ } |
+ } |
+ } |
+ s_criticalSectionLocal.Unlock(); |
+ |
+ return tab; |
+} |
+ |
STDMETHODIMP CPluginClass::QueryStatus(const GUID* pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT* pCmdText) |
{ |