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

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

Issue 29331767: Issue #1234 + Clean up - CPluginTab (dead code, nullptr defect fix, etc.) (Closed)
Patch Set: add removal of stub class, optimization for res:// Created Dec. 3, 2015, 7:27 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/PluginTabBase.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 /* 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(CPluginClass* plugin) 28 CPluginTab::CPluginTab()
29 : m_plugin(plugin) 29 : m_isActivated(false)
30 , m_isActivated(false)
31 , m_continueThreadRunning(true) 30 , m_continueThreadRunning(true)
32 { 31 {
33 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); 32 m_filter.hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL);
34 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL);
35 33
36 CPluginClient* client = CPluginClient::GetInstance(); 34 CPluginClient* client = CPluginClient::GetInstance();
37 if (AdblockPlus::IE::InstalledMajorVersion() < 10) 35 if (AdblockPlus::IE::InstalledMajorVersion() < 10)
38 { 36 {
39 m_isActivated = true; 37 m_isActivated = true;
40 } 38 }
41 39
42 try 40 try
43 { 41 {
44 m_thread = std::thread(&CPluginTabBase::ThreadProc, this); 42 m_thread = std::thread(&CPluginTab::ThreadProc, this);
45 } 43 }
46 catch (const std::system_error& ex) 44 catch (const std::system_error& ex)
47 { 45 {
48 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,
49 "Tab::Thread - Failed to create tab thread"); 47 "Tab::Thread - Failed to create tab thread");
50 } 48 }
51 m_traverser = new CPluginDomTraverser(static_cast<CPluginTab*>(this)); 49 m_traverser = new CPluginDomTraverser(static_cast<CPluginTab*>(this));
52 } 50 }
53 51
54 52
55 CPluginTabBase::~CPluginTabBase() 53 CPluginTab::~CPluginTab()
56 { 54 {
57 delete m_traverser; 55 delete m_traverser;
58 m_traverser = NULL; 56 m_traverser = NULL;
59 m_continueThreadRunning = false; 57 m_continueThreadRunning = false;
60 if (m_thread.joinable()) { 58 if (m_thread.joinable()) {
61 m_thread.join(); 59 m_thread.join();
62 } 60 }
63 } 61 }
64 62
65 void CPluginTabBase::OnActivate() 63 void CPluginTab::OnActivate()
66 { 64 {
67 m_isActivated = true; 65 m_isActivated = true;
68 } 66 }
69 67
70 68
71 void CPluginTabBase::OnUpdate() 69 void CPluginTab::OnUpdate()
72 { 70 {
73 m_isActivated = true; 71 m_isActivated = true;
74 } 72 }
75 73
76 namespace 74 namespace
77 { 75 {
78 // Entry Point 76 // Entry Point
79 void FilterLoader(CPluginTabBase* tabBase) 77 void FilterLoader(CPluginFilter* filter, const std::wstring& domain)
80 { 78 {
81 try 79 try
82 { 80 {
83 tabBase->m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetElemen tHidingSelectors(tabBase->GetDocumentDomain())); 81 filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHidingSele ctors(domain));
84 SetEvent(tabBase->m_filter->hideFiltersLoadedEvent); 82 SetEvent(filter->hideFiltersLoadedEvent);
85 } 83 }
86 catch (...) 84 catch (...)
87 { 85 {
88 // As a thread-main function, we truncate any C++ exception. 86 // As a thread-main function, we truncate any C++ exception.
89 } 87 }
90 } 88 }
91 } 89 }
92 90
93 void CPluginTabBase::OnNavigate(const std::wstring& url) 91 void CPluginTab::OnNavigate(const std::wstring& url)
94 { 92 {
95 SetDocumentUrl(url); 93 SetDocumentUrl(url);
96 ClearFrameCache(GetDocumentDomain()); 94 ClearFrameCache(GetDocumentDomain());
97 std::wstring domainString = GetDocumentDomain(); 95 std::wstring domainString = GetDocumentDomain();
98 ResetEvent(m_filter->hideFiltersLoadedEvent); 96 ResetEvent(m_filter.hideFiltersLoadedEvent);
99 try 97 try
100 { 98 {
101 std::thread filterLoaderThread(&FilterLoader, this); 99 std::thread filterLoaderThread(&FilterLoader, &m_filter, GetDocumentDomain() );
102 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.
103 } 101 }
104 catch (const std::system_error& ex) 102 catch (const std::system_error& ex)
105 { 103 {
106 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_THREAD_CRE ATE_PROCESS, 104 DEBUG_SYSTEM_EXCEPTION(ex, PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_THREAD_CRE ATE_PROCESS,
107 "Class::Thread - Failed to start filter loader thread"); 105 "Class::Thread - Failed to start filter loader thread");
108 } 106 }
109 m_traverser->ClearCache(); 107 m_traverser->ClearCache();
110 } 108 }
111 109
(...skipping 28 matching lines...) Expand all
140 return false; 138 return false;
141 } 139 }
142 auto urlCstr = url.c_str(); 140 auto urlCstr = url.c_str();
143 // Check the prefix to match our directory 141 // Check the prefix to match our directory
144 // Check the suffix to be an HTML file 142 // Check the suffix to be an HTML file
145 return (_wcsnicmp(urlCstr, dir.c_str(), dir.length()) == 0) && 143 return (_wcsnicmp(urlCstr, dir.c_str(), dir.length()) == 0) &&
146 (_wcsnicmp(urlCstr + url.length() - 5, L".html", 5) == 0); 144 (_wcsnicmp(urlCstr + url.length() - 5, L".html", 5) == 0);
147 } 145 }
148 } 146 }
149 147
150 void CPluginTabBase::InjectABP(IWebBrowser2* browser) 148 void CPluginTab::InjectABP(IWebBrowser2* browser)
151 { 149 {
152 CriticalSection::Lock lock(m_csInject); 150 CriticalSection::Lock lock(m_csInject);
153 auto url = GetDocumentUrl(); 151 auto url = GetDocumentUrl();
154 if (!IsOurHtmlFile(url)) 152 if (!IsOurHtmlFile(url))
155 { 153 {
156 DEBUG_GENERAL(L"InjectABP. Not injecting"); 154 DEBUG_GENERAL(L"InjectABP. Not injecting");
157 return; 155 return;
158 } 156 }
159 DEBUG_GENERAL(L"InjectABP. Injecting"); 157 DEBUG_GENERAL(L"InjectABP. Injecting");
160 CComPtr<IDispatch> pDocDispatch; 158 CComPtr<IDispatch> pDocDispatch;
161 browser->get_Document(&pDocDispatch); 159 browser->get_Document(&pDocDispatch);
162 CComQIPtr<IHTMLDocument2> pDoc2(pDocDispatch); 160 CComQIPtr<IHTMLDocument2> pDoc2(pDocDispatch);
163 if (!pDoc2) 161 if (!pDoc2)
164 { 162 {
165 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") ;
166 return; 164 return;
167 } 165 }
168 CComPtr<IHTMLWindow2> pWnd2; 166 CComPtr<IHTMLWindow2> pWnd2;
169 pDoc2->get_parentWindow(&pWnd2); 167 pDoc2->get_parentWindow(&pWnd2);
170 if (!pWnd2) 168 if (!pWnd2)
171 { 169 {
172 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");
173 return; 171 return;
174 } 172 }
175 CComQIPtr<IDispatchEx> pWndEx(pWnd2); 173 CComQIPtr<IDispatchEx> pWndEx(pWnd2);
176 if (!pWndEx) 174 if (!pWndEx)
177 { 175 {
178 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") ;
179 return; 177 return;
180 } 178 }
181 // Create "Settings" object in JavaScript. 179 // Create "Settings" object in JavaScript.
182 // 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
183 DISPID dispid; 181 DISPID dispid;
184 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid); 182 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid);
185 if (FAILED(hr)) 183 if (FAILED(hr))
186 { 184 {
187 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 ");
188 return; 186 return;
189 } 187 }
190 CComVariant var((IDispatch*)&m_pluginUserSettings); 188 CComVariant var((IDispatch*)&m_pluginUserSettings);
191 189
192 DEBUG_GENERAL("Injecting"); 190 DEBUG_GENERAL("Injecting");
193 191
194 DISPPARAMS params; 192 DISPPARAMS params;
195 params.cArgs = 1; 193 params.cArgs = 1;
196 params.cNamedArgs = 0; 194 params.cNamedArgs = 0;
197 params.rgvarg = &var; 195 params.rgvarg = &var;
198 params.rgdispidNamedArgs = 0; 196 params.rgdispidNamedArgs = 0;
199 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPU T | DISPATCH_PROPERTYPUTREF, &params, 0, 0, 0); 197 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPU T | DISPATCH_PROPERTYPUTREF, &params, 0, 0, 0);
200 DEBUG_GENERAL("Invoke"); 198 DEBUG_GENERAL("Invoke");
201 if (FAILED(hr)) 199 if (FAILED(hr))
202 { 200 {
203 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");
204 } 202 }
205 } 203 }
206 204
207 namespace 205 namespace
208 { 206 {
209 ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser) 207 ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser)
210 { 208 {
211 ATL::CComPtr<IDispatch> parentDispatch; 209 ATL::CComPtr<IDispatch> parentDispatch;
212 if (FAILED(browser.get_Parent(&parentDispatch)) || !parentDispatch) 210 if (FAILED(browser.get_Parent(&parentDispatch)) || !parentDispatch)
213 { 211 {
(...skipping 29 matching lines...) Expand all
243 while(frame = GetParent(*frame)) 241 while(frame = GetParent(*frame))
244 { 242 {
245 frameHierarchy.push_back(ToUtf8String(GetLocationUrl(*frame))); 243 frameHierarchy.push_back(ToUtf8String(GetLocationUrl(*frame)));
246 } 244 }
247 CPluginClient* client = CPluginClient::GetInstance(); 245 CPluginClient* client = CPluginClient::GetInstance();
248 return client->IsWhitelistedUrl(url, frameHierarchy) 246 return client->IsWhitelistedUrl(url, frameHierarchy)
249 || client->IsElemhideWhitelistedOnDomain(url, frameHierarchy); 247 || client->IsElemhideWhitelistedOnDomain(url, frameHierarchy);
250 } 248 }
251 } 249 }
252 250
253 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) 251 void CPluginTab::OnDownloadComplete(IWebBrowser2* browser)
254 { 252 {
255 CPluginClient* client = CPluginClient::GetInstance(); 253 CPluginClient* client = CPluginClient::GetInstance();
256 std::wstring url = GetDocumentUrl(); 254 std::wstring url = GetDocumentUrl();
257 if (!client->IsWhitelistedUrl(url) && !client->IsElemhideWhitelistedOnDomain(u rl)) 255 if (!client->IsWhitelistedUrl(url) && !client->IsElemhideWhitelistedOnDomain(u rl))
258 { 256 {
259 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl() ); 257 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl() );
260 } 258 }
261 InjectABP(browser); 259 InjectABP(browser);
262 } 260 }
263 261
264 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)
265 { 263 {
266 std::wstring documentUrl = GetDocumentUrl(); 264 std::wstring documentUrl = GetDocumentUrl();
267 265
268 if (isDocumentBrowser) 266 if (isDocumentBrowser)
269 { 267 {
270 if (url != documentUrl) 268 if (url != documentUrl)
271 { 269 {
272 SetDocumentUrl(url); 270 SetDocumentUrl(url);
273 } 271 }
274 InjectABP(browser); 272 InjectABP(browser);
275 } 273 }
276 CString urlLegacy = ToCString(url); 274 CString urlLegacy = ToCString(url);
277 if (urlLegacy.Left(6) != "res://") 275 if (urlLegacy.Left(6) == "res://")
278 { 276 {
279 // Get document 277 return;
280 CComPtr<IDispatch> pDocDispatch; 278 }
281 HRESULT hr = browser->get_Document(&pDocDispatch); 279 // Get document
282 if (FAILED(hr) || !pDocDispatch) 280 CComPtr<IDispatch> pDocDispatch;
281 HRESULT hr = browser->get_Document(&pDocDispatch);
282 if (FAILED(hr) || !pDocDispatch)
283 {
284 return;
285 }
286
287 CComQIPtr<IHTMLDocument2> pDoc(pDocDispatch);
288 if (!pDoc)
289 {
290 return;
291 }
292
293 CComPtr<IOleObject> pOleObj;
294 pDocDispatch->QueryInterface(&pOleObj);
295 if (!pOleObj)
296 {
297 return;
298 }
299 CComPtr<IOleClientSite> pClientSite;
300 pOleObj->GetClientSite(&pClientSite);
301 if (pClientSite != NULL)
302 {
303 CComPtr<IDocHostUIHandler> docHostUIHandler;
304 pClientSite->QueryInterface(&docHostUIHandler);
305 if (docHostUIHandler != NULL)
283 { 306 {
284 return; 307 docHostUIHandler->UpdateUI();
285 }
286
287 CComQIPtr<IHTMLDocument2> pDoc(pDocDispatch);
288 if (!pDoc)
289 {
290 return;
291 }
292
293 CComPtr<IOleObject> pOleObj;
294 pDocDispatch->QueryInterface(&pOleObj);
295 if (!pOleObj)
296 {
297 return;
298 }
299 CComPtr<IOleClientSite> pClientSite;
300 pOleObj->GetClientSite(&pClientSite);
301 if (pClientSite != NULL)
302 {
303 CComPtr<IDocHostUIHandler> docHostUIHandler;
304 pClientSite->QueryInterface(&docHostUIHandler);
305 if (docHostUIHandler != NULL)
306 {
307 docHostUIHandler->UpdateUI();
308 }
309 } 308 }
310 } 309 }
311 } 310 }
312 311
313 std::wstring CPluginTabBase::GetDocumentDomain() 312 std::wstring CPluginTab::GetDocumentDomain()
314 { 313 {
315 std::wstring domain; 314 std::wstring domain;
316 315
317 m_criticalSection.Lock(); 316 m_criticalSection.Lock();
318 { 317 {
319 domain = m_documentDomain; 318 domain = m_documentDomain;
320 } 319 }
321 m_criticalSection.Unlock(); 320 m_criticalSection.Unlock();
322 321
323 return domain; 322 return domain;
324 } 323 }
325 324
326 void CPluginTabBase::SetDocumentUrl(const std::wstring& url) 325 void CPluginTab::SetDocumentUrl(const std::wstring& url)
327 { 326 {
328 m_criticalSection.Lock(); 327 m_criticalSection.Lock();
329 { 328 {
330 m_documentUrl = url; 329 m_documentUrl = url;
331 m_documentDomain = CAdblockPlusClient::GetInstance()->GetHostFromUrl(url); 330 m_documentDomain = CAdblockPlusClient::GetInstance()->GetHostFromUrl(url);
332 } 331 }
333 m_criticalSection.Unlock(); 332 m_criticalSection.Unlock();
334 } 333 }
335 334
336 std::wstring CPluginTabBase::GetDocumentUrl() 335 std::wstring CPluginTab::GetDocumentUrl()
337 { 336 {
338 std::wstring url; 337 std::wstring url;
339 338
340 m_criticalSection.Lock(); 339 m_criticalSection.Lock();
341 { 340 {
342 url = m_documentUrl; 341 url = m_documentUrl;
343 } 342 }
344 m_criticalSection.Unlock(); 343 m_criticalSection.Unlock();
345 344
346 return url; 345 return url;
347 } 346 }
348 347
349 348
350 // ============================================================================ 349 // ============================================================================
351 // Frame caching 350 // Frame caching
352 // ============================================================================ 351 // ============================================================================
353 bool CPluginTabBase::IsFrameCached(const std::wstring& url) 352 bool CPluginTab::IsFrameCached(const std::wstring& url)
354 { 353 {
355 bool isFrame; 354 bool isFrame;
356 355
357 m_criticalSectionCache.Lock(); 356 m_criticalSectionCache.Lock();
358 { 357 {
359 isFrame = m_cacheFrames.find(url) != m_cacheFrames.end(); 358 isFrame = m_cacheFrames.find(url) != m_cacheFrames.end();
360 } 359 }
361 m_criticalSectionCache.Unlock(); 360 m_criticalSectionCache.Unlock();
362 361
363 return isFrame; 362 return isFrame;
364 } 363 }
365 364
366 void CPluginTabBase::CacheFrame(const std::wstring& url) 365 void CPluginTab::CacheFrame(const std::wstring& url)
367 { 366 {
368 m_criticalSectionCache.Lock(); 367 m_criticalSectionCache.Lock();
369 { 368 {
370 m_cacheFrames.insert(url); 369 m_cacheFrames.insert(url);
371 } 370 }
372 m_criticalSectionCache.Unlock(); 371 m_criticalSectionCache.Unlock();
373 } 372 }
374 373
375 void CPluginTabBase::ClearFrameCache(const std::wstring& domain) 374 void CPluginTab::ClearFrameCache(const std::wstring& domain)
376 { 375 {
377 m_criticalSectionCache.Lock(); 376 m_criticalSectionCache.Lock();
378 { 377 {
379 if (domain.empty() || domain != m_cacheDomain) 378 if (domain.empty() || domain != m_cacheDomain)
380 { 379 {
381 m_cacheFrames.clear(); 380 m_cacheFrames.clear();
382 m_cacheDomain = domain; 381 m_cacheDomain = domain;
383 } 382 }
384 } 383 }
385 m_criticalSectionCache.Unlock(); 384 m_criticalSectionCache.Unlock();
386 } 385 }
387 386
388 void CPluginTabBase::ThreadProc() 387 void CPluginTab::ThreadProc()
389 { 388 {
390 // Force loading/creation of settings 389 // Force loading/creation of settings
391 CPluginSettings::GetInstance()->SetWorkingThreadId(); 390 CPluginSettings::GetInstance()->SetWorkingThreadId();
392 391
393 std::string message = 392 std::string message =
394 "=========================================================================== =====\n" 393 "=========================================================================== =====\n"
395 "TAB THREAD process="; 394 "TAB THREAD process=";
396 message += std::to_string(::GetCurrentProcessId()); 395 message += std::to_string(::GetCurrentProcessId());
397 message + " thread="; 396 message + " thread=";
398 message += std::to_string(::GetCurrentThreadId()); 397 message += std::to_string(::GetCurrentThreadId());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId()); 433 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId());
435 } 434 }
436 435
437 // Non-hanging sleep 436 // Non-hanging sleep
438 Sleep(50); 437 Sleep(50);
439 } 438 }
440 439
441 tabLoopIteration++; 440 tabLoopIteration++;
442 } 441 }
443 } 442 }
OLDNEW
« no previous file with comments | « src/plugin/PluginTabBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld