LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #include "PluginStdAfx.h" | 18 #include "PluginStdAfx.h" |
19 #include "AdblockPlusClient.h" | 19 #include "AdblockPlusClient.h" |
20 #include "PluginClientBase.h" | 20 #include "PluginClientBase.h" |
21 #include "PluginSettings.h" | 21 #include "PluginSettings.h" |
22 #include "AdblockPlusDomTraverser.h" | 22 #include "AdblockPlusDomTraverser.h" |
23 #include "PluginTabBase.h" | 23 #include "PluginTabBase.h" |
24 #include "IeVersion.h" | 24 #include "IeVersion.h" |
25 #include "../shared/Utils.h" | 25 #include "../shared/Utils.h" |
26 #include <Mshtmhst.h> | 26 #include <Mshtmhst.h> |
27 | 27 |
28 CPluginTabBase::CPluginTabBase() | 28 CPluginTab::CPluginTab() |
29 : m_isActivated(false) | 29 : m_isActivated(false) |
30 , m_continueThreadRunning(true) | 30 , m_continueThreadRunning(true) |
31 { | 31 { |
32 m_filter.hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); | 32 m_filter.hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); |
33 | 33 |
34 CPluginClient* client = CPluginClient::GetInstance(); | 34 CPluginClient* client = CPluginClient::GetInstance(); |
35 if (AdblockPlus::IE::InstalledMajorVersion() < 10) | 35 if (AdblockPlus::IE::InstalledMajorVersion() < 10) |
36 { | 36 { |
37 m_isActivated = true; | 37 m_isActivated = true; |
38 } | 38 } |
39 | 39 |
40 try | 40 try |
41 { | 41 { |
42 m_thread = std::thread(&CPluginTabBase::ThreadProc, this); | 42 m_thread = std::thread(&CPluginTab::ThreadProc, this); |
43 } | 43 } |
44 catch (const std::system_error& ex) | 44 catch (const std::system_error& ex) |
45 { | 45 { |
46 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_TAB_THREAD_CREA
TE_PROCESS, | 46 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_TAB_THREAD_CREA
TE_PROCESS, |
47 "Tab::Thread - Failed to create tab thread"); | 47 "Tab::Thread - Failed to create tab thread"); |
48 } | 48 } |
49 m_traverser = new CPluginDomTraverser(static_cast<CPluginTab*>(this)); | 49 m_traverser = new CPluginDomTraverser(static_cast<CPluginTab*>(this)); |
50 } | 50 } |
51 | 51 |
52 | 52 |
53 CPluginTabBase::~CPluginTabBase() | 53 CPluginTab::~CPluginTab() |
54 { | 54 { |
55 delete m_traverser; | 55 delete m_traverser; |
56 m_traverser = NULL; | 56 m_traverser = NULL; |
57 m_continueThreadRunning = false; | 57 m_continueThreadRunning = false; |
58 if (m_thread.joinable()) { | 58 if (m_thread.joinable()) { |
59 m_thread.join(); | 59 m_thread.join(); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void CPluginTabBase::OnActivate() | 63 void CPluginTab::OnActivate() |
64 { | 64 { |
65 m_isActivated = true; | 65 m_isActivated = true; |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 void CPluginTabBase::OnUpdate() | 69 void CPluginTab::OnUpdate() |
70 { | 70 { |
71 m_isActivated = true; | 71 m_isActivated = true; |
72 } | 72 } |
73 | 73 |
74 namespace | 74 namespace |
75 { | 75 { |
76 // Entry Point | 76 // Entry Point |
77 void FilterLoader(CPluginFilter* filter, const std::wstring& domain) | 77 void FilterLoader(CPluginFilter* filter, const std::wstring& domain) |
78 { | 78 { |
79 try | 79 try |
80 { | 80 { |
81 filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHidingSele
ctors(domain)); | 81 filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHidingSele
ctors(domain)); |
82 SetEvent(filter->hideFiltersLoadedEvent); | 82 SetEvent(filter->hideFiltersLoadedEvent); |
83 } | 83 } |
84 catch (...) | 84 catch (...) |
85 { | 85 { |
86 // As a thread-main function, we truncate any C++ exception. | 86 // As a thread-main function, we truncate any C++ exception. |
87 } | 87 } |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 void CPluginTabBase::OnNavigate(const std::wstring& url) | 91 void CPluginTab::OnNavigate(const std::wstring& url) |
92 { | 92 { |
93 SetDocumentUrl(url); | 93 SetDocumentUrl(url); |
94 ClearFrameCache(GetDocumentDomain()); | 94 ClearFrameCache(GetDocumentDomain()); |
95 std::wstring domainString = GetDocumentDomain(); | 95 std::wstring domainString = GetDocumentDomain(); |
96 ResetEvent(m_filter.hideFiltersLoadedEvent); | 96 ResetEvent(m_filter.hideFiltersLoadedEvent); |
97 try | 97 try |
98 { | 98 { |
99 std::thread filterLoaderThread(&FilterLoader, &m_filter, GetDocumentDomain()
); | 99 std::thread filterLoaderThread(&FilterLoader, &m_filter, GetDocumentDomain()
); |
100 filterLoaderThread.detach(); // TODO: but actually we should wait for the th
read in the dtr. | 100 filterLoaderThread.detach(); // TODO: but actually we should wait for the th
read in the dtr. |
101 } | 101 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return false; | 138 return false; |
139 } | 139 } |
140 auto urlCstr = url.c_str(); | 140 auto urlCstr = url.c_str(); |
141 // Check the prefix to match our directory | 141 // Check the prefix to match our directory |
142 // Check the suffix to be an HTML file | 142 // Check the suffix to be an HTML file |
143 return (_wcsnicmp(urlCstr, dir.c_str(), dir.length()) == 0) && | 143 return (_wcsnicmp(urlCstr, dir.c_str(), dir.length()) == 0) && |
144 (_wcsnicmp(urlCstr + url.length() - 5, L".html", 5) == 0); | 144 (_wcsnicmp(urlCstr + url.length() - 5, L".html", 5) == 0); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 void CPluginTabBase::InjectABP(IWebBrowser2* browser) | 148 void CPluginTab::InjectABP(IWebBrowser2* browser) |
149 { | 149 { |
150 CriticalSection::Lock lock(m_csInject); | 150 CriticalSection::Lock lock(m_csInject); |
151 auto url = GetDocumentUrl(); | 151 auto url = GetDocumentUrl(); |
152 if (!IsOurHtmlFile(url)) | 152 if (!IsOurHtmlFile(url)) |
153 { | 153 { |
154 DEBUG_GENERAL(L"InjectABP. Not injecting"); | 154 DEBUG_GENERAL(L"InjectABP. Not injecting"); |
155 return; | 155 return; |
156 } | 156 } |
157 DEBUG_GENERAL(L"InjectABP. Injecting"); | 157 DEBUG_GENERAL(L"InjectABP. Injecting"); |
158 CComPtr<IDispatch> pDocDispatch; | 158 CComPtr<IDispatch> pDocDispatch; |
159 browser->get_Document(&pDocDispatch); | 159 browser->get_Document(&pDocDispatch); |
160 CComQIPtr<IHTMLDocument2> pDoc2(pDocDispatch); | 160 CComQIPtr<IHTMLDocument2> pDoc2(pDocDispatch); |
161 if (!pDoc2) | 161 if (!pDoc2) |
162 { | 162 { |
163 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI docume
nt"); | 163 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTab::InjectABP - Failed to QI document")
; |
164 return; | 164 return; |
165 } | 165 } |
166 CComPtr<IHTMLWindow2> pWnd2; | 166 CComPtr<IHTMLWindow2> pWnd2; |
167 pDoc2->get_parentWindow(&pWnd2); | 167 pDoc2->get_parentWindow(&pWnd2); |
168 if (!pWnd2) | 168 if (!pWnd2) |
169 { | 169 { |
170 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to get paren
t window"); | 170 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTab::InjectABP - Failed to get parent wi
ndow"); |
171 return; | 171 return; |
172 } | 172 } |
173 CComQIPtr<IDispatchEx> pWndEx(pWnd2); | 173 CComQIPtr<IDispatchEx> pWndEx(pWnd2); |
174 if (!pWndEx) | 174 if (!pWndEx) |
175 { | 175 { |
176 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI dispat
ch"); | 176 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE
ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTab::InjectABP - Failed to QI dispatch")
; |
177 return; | 177 return; |
178 } | 178 } |
179 // Create "Settings" object in JavaScript. | 179 // Create "Settings" object in JavaScript. |
180 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_plug
inUserSettings | 180 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_plug
inUserSettings |
181 DISPID dispid; | 181 DISPID dispid; |
182 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid); | 182 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid); |
183 if (FAILED(hr)) | 183 if (FAILED(hr)) |
184 { | 184 { |
185 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR
EATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to get disp
atch"); | 185 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR
EATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTab::InjectABP - Failed to get dispatch
"); |
186 return; | 186 return; |
187 } | 187 } |
188 CComVariant var((IDispatch*)&m_pluginUserSettings); | 188 CComVariant var((IDispatch*)&m_pluginUserSettings); |
189 | 189 |
190 DEBUG_GENERAL("Injecting"); | 190 DEBUG_GENERAL("Injecting"); |
191 | 191 |
192 DISPPARAMS params; | 192 DISPPARAMS params; |
193 params.cArgs = 1; | 193 params.cArgs = 1; |
194 params.cNamedArgs = 0; | 194 params.cNamedArgs = 0; |
195 params.rgvarg = &var; | 195 params.rgvarg = &var; |
196 params.rgdispidNamedArgs = 0; | 196 params.rgdispidNamedArgs = 0; |
197 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPU
T | DISPATCH_PROPERTYPUTREF, ¶ms, 0, 0, 0); | 197 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPU
T | DISPATCH_PROPERTYPUTREF, ¶ms, 0, 0, 0); |
198 DEBUG_GENERAL("Invoke"); | 198 DEBUG_GENERAL("Invoke"); |
199 if (FAILED(hr)) | 199 if (FAILED(hr)) |
200 { | 200 { |
201 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR
EATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to create S
ettings in JavaScript"); | 201 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR
EATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTab::InjectABP - Failed to create Setti
ngs in JavaScript"); |
202 } | 202 } |
203 } | 203 } |
204 | 204 |
205 namespace | 205 namespace |
206 { | 206 { |
207 ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser) | 207 ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser) |
208 { | 208 { |
209 ATL::CComPtr<IDispatch> parentDispatch; | 209 ATL::CComPtr<IDispatch> parentDispatch; |
210 if (FAILED(browser.get_Parent(&parentDispatch)) || !parentDispatch) | 210 if (FAILED(browser.get_Parent(&parentDispatch)) || !parentDispatch) |
211 { | 211 { |
(...skipping 29 matching lines...) Expand all Loading... |
241 while(frame = GetParent(*frame)) | 241 while(frame = GetParent(*frame)) |
242 { | 242 { |
243 frameHierarchy.push_back(ToUtf8String(GetLocationUrl(*frame))); | 243 frameHierarchy.push_back(ToUtf8String(GetLocationUrl(*frame))); |
244 } | 244 } |
245 CPluginClient* client = CPluginClient::GetInstance(); | 245 CPluginClient* client = CPluginClient::GetInstance(); |
246 return client->IsWhitelistedUrl(url, frameHierarchy) | 246 return client->IsWhitelistedUrl(url, frameHierarchy) |
247 || client->IsElemhideWhitelistedOnDomain(url, frameHierarchy); | 247 || client->IsElemhideWhitelistedOnDomain(url, frameHierarchy); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) | 251 void CPluginTab::OnDownloadComplete(IWebBrowser2* browser) |
252 { | 252 { |
253 CPluginClient* client = CPluginClient::GetInstance(); | 253 CPluginClient* client = CPluginClient::GetInstance(); |
254 std::wstring url = GetDocumentUrl(); | 254 std::wstring url = GetDocumentUrl(); |
255 if (!client->IsWhitelistedUrl(url) && !client->IsElemhideWhitelistedOnDomain(u
rl)) | 255 if (!client->IsWhitelistedUrl(url) && !client->IsElemhideWhitelistedOnDomain(u
rl)) |
256 { | 256 { |
257 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl()
); | 257 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl()
); |
258 } | 258 } |
259 InjectABP(browser); | 259 InjectABP(browser); |
260 } | 260 } |
261 | 261 |
262 void CPluginTabBase::OnDocumentComplete(IWebBrowser2* browser, const std::wstrin
g& url, bool isDocumentBrowser) | 262 void CPluginTab::OnDocumentComplete(IWebBrowser2* browser, const std::wstring& u
rl, bool isDocumentBrowser) |
263 { | 263 { |
264 std::wstring documentUrl = GetDocumentUrl(); | 264 std::wstring documentUrl = GetDocumentUrl(); |
265 | 265 |
266 if (isDocumentBrowser) | 266 if (isDocumentBrowser) |
267 { | 267 { |
268 if (url != documentUrl) | 268 if (url != documentUrl) |
269 { | 269 { |
270 SetDocumentUrl(url); | 270 SetDocumentUrl(url); |
271 } | 271 } |
272 InjectABP(browser); | 272 InjectABP(browser); |
273 } | 273 } |
274 CString urlLegacy = ToCString(url); | 274 if (BeginsWith(url, L"res://")) |
275 if (urlLegacy.Left(6) != "res://") | 275 { |
276 { | 276 return; |
277 // Get document | 277 } |
278 CComPtr<IDispatch> pDocDispatch; | 278 // Get document |
279 HRESULT hr = browser->get_Document(&pDocDispatch); | 279 CComPtr<IDispatch> pDocDispatch; |
280 if (FAILED(hr) || !pDocDispatch) | 280 HRESULT hr = browser->get_Document(&pDocDispatch); |
281 { | 281 if (FAILED(hr) || !pDocDispatch) |
282 return; | 282 { |
283 } | 283 return; |
284 | 284 } |
285 CComQIPtr<IHTMLDocument2> pDoc(pDocDispatch); | 285 |
286 if (!pDoc) | 286 CComQIPtr<IHTMLDocument2> pDoc(pDocDispatch); |
287 { | 287 if (!pDoc) |
288 return; | 288 { |
289 } | 289 return; |
290 | 290 } |
291 CComPtr<IOleObject> pOleObj; | 291 |
292 pDocDispatch->QueryInterface(&pOleObj); | 292 CComPtr<IOleObject> pOleObj; |
293 if (!pOleObj) | 293 pDocDispatch->QueryInterface(&pOleObj); |
294 { | 294 if (!pOleObj) |
295 return; | 295 { |
296 } | 296 return; |
297 CComPtr<IOleClientSite> pClientSite; | 297 } |
298 pOleObj->GetClientSite(&pClientSite); | 298 CComPtr<IOleClientSite> pClientSite; |
299 if (pClientSite != NULL) | 299 pOleObj->GetClientSite(&pClientSite); |
300 { | 300 if (pClientSite != NULL) |
301 CComPtr<IDocHostUIHandler> docHostUIHandler; | 301 { |
302 pClientSite->QueryInterface(&docHostUIHandler); | 302 CComPtr<IDocHostUIHandler> docHostUIHandler; |
303 if (docHostUIHandler != NULL) | 303 pClientSite->QueryInterface(&docHostUIHandler); |
304 { | 304 if (docHostUIHandler != NULL) |
305 docHostUIHandler->UpdateUI(); | 305 { |
306 } | 306 docHostUIHandler->UpdateUI(); |
307 } | 307 } |
308 } | 308 } |
309 } | 309 } |
310 | 310 |
311 std::wstring CPluginTabBase::GetDocumentDomain() | 311 std::wstring CPluginTab::GetDocumentDomain() |
312 { | 312 { |
313 std::wstring domain; | 313 std::wstring domain; |
314 | 314 |
315 m_criticalSection.Lock(); | 315 m_criticalSection.Lock(); |
316 { | 316 { |
317 domain = m_documentDomain; | 317 domain = m_documentDomain; |
318 } | 318 } |
319 m_criticalSection.Unlock(); | 319 m_criticalSection.Unlock(); |
320 | 320 |
321 return domain; | 321 return domain; |
322 } | 322 } |
323 | 323 |
324 void CPluginTabBase::SetDocumentUrl(const std::wstring& url) | 324 void CPluginTab::SetDocumentUrl(const std::wstring& url) |
325 { | 325 { |
326 m_criticalSection.Lock(); | 326 m_criticalSection.Lock(); |
327 { | 327 { |
328 m_documentUrl = url; | 328 m_documentUrl = url; |
329 m_documentDomain = CAdblockPlusClient::GetInstance()->GetHostFromUrl(url); | 329 m_documentDomain = CAdblockPlusClient::GetInstance()->GetHostFromUrl(url); |
330 } | 330 } |
331 m_criticalSection.Unlock(); | 331 m_criticalSection.Unlock(); |
332 } | 332 } |
333 | 333 |
334 std::wstring CPluginTabBase::GetDocumentUrl() | 334 std::wstring CPluginTab::GetDocumentUrl() |
335 { | 335 { |
336 std::wstring url; | 336 std::wstring url; |
337 | 337 |
338 m_criticalSection.Lock(); | 338 m_criticalSection.Lock(); |
339 { | 339 { |
340 url = m_documentUrl; | 340 url = m_documentUrl; |
341 } | 341 } |
342 m_criticalSection.Unlock(); | 342 m_criticalSection.Unlock(); |
343 | 343 |
344 return url; | 344 return url; |
345 } | 345 } |
346 | 346 |
347 | 347 |
348 // ============================================================================ | 348 // ============================================================================ |
349 // Frame caching | 349 // Frame caching |
350 // ============================================================================ | 350 // ============================================================================ |
351 bool CPluginTabBase::IsFrameCached(const std::wstring& url) | 351 bool CPluginTab::IsFrameCached(const std::wstring& url) |
352 { | 352 { |
353 bool isFrame; | 353 bool isFrame; |
354 | 354 |
355 m_criticalSectionCache.Lock(); | 355 m_criticalSectionCache.Lock(); |
356 { | 356 { |
357 isFrame = m_cacheFrames.find(url) != m_cacheFrames.end(); | 357 isFrame = m_cacheFrames.find(url) != m_cacheFrames.end(); |
358 } | 358 } |
359 m_criticalSectionCache.Unlock(); | 359 m_criticalSectionCache.Unlock(); |
360 | 360 |
361 return isFrame; | 361 return isFrame; |
362 } | 362 } |
363 | 363 |
364 void CPluginTabBase::CacheFrame(const std::wstring& url) | 364 void CPluginTab::CacheFrame(const std::wstring& url) |
365 { | 365 { |
366 m_criticalSectionCache.Lock(); | 366 m_criticalSectionCache.Lock(); |
367 { | 367 { |
368 m_cacheFrames.insert(url); | 368 m_cacheFrames.insert(url); |
369 } | 369 } |
370 m_criticalSectionCache.Unlock(); | 370 m_criticalSectionCache.Unlock(); |
371 } | 371 } |
372 | 372 |
373 void CPluginTabBase::ClearFrameCache(const std::wstring& domain) | 373 void CPluginTab::ClearFrameCache(const std::wstring& domain) |
374 { | 374 { |
375 m_criticalSectionCache.Lock(); | 375 m_criticalSectionCache.Lock(); |
376 { | 376 { |
377 if (domain.empty() || domain != m_cacheDomain) | 377 if (domain.empty() || domain != m_cacheDomain) |
378 { | 378 { |
379 m_cacheFrames.clear(); | 379 m_cacheFrames.clear(); |
380 m_cacheDomain = domain; | 380 m_cacheDomain = domain; |
381 } | 381 } |
382 } | 382 } |
383 m_criticalSectionCache.Unlock(); | 383 m_criticalSectionCache.Unlock(); |
384 } | 384 } |
385 | 385 |
386 void CPluginTabBase::ThreadProc() | 386 void CPluginTab::ThreadProc() |
387 { | 387 { |
388 // Force loading/creation of settings | 388 // Force loading/creation of settings |
389 CPluginSettings::GetInstance()->SetWorkingThreadId(); | 389 CPluginSettings::GetInstance()->SetWorkingThreadId(); |
390 | 390 |
391 std::string message = | 391 std::string message = |
392 "===========================================================================
=====\n" | 392 "===========================================================================
=====\n" |
393 "TAB THREAD process="; | 393 "TAB THREAD process="; |
394 message += std::to_string(::GetCurrentProcessId()); | 394 message += std::to_string(::GetCurrentProcessId()); |
395 message + " thread="; | 395 message + " thread="; |
396 message += std::to_string(::GetCurrentThreadId()); | 396 message += std::to_string(::GetCurrentThreadId()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr
rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p
luginError.GetProcessId(), pluginError.GetThreadId()); | 432 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr
rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p
luginError.GetProcessId(), pluginError.GetThreadId()); |
433 } | 433 } |
434 | 434 |
435 // Non-hanging sleep | 435 // Non-hanging sleep |
436 Sleep(50); | 436 Sleep(50); |
437 } | 437 } |
438 | 438 |
439 tabLoopIteration++; | 439 tabLoopIteration++; |
440 } | 440 } |
441 } | 441 } |
LEFT | RIGHT |