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

Delta Between Two Patch Sets: src/plugin/PluginTabBase.cpp

Issue 5171515343503360: Issue #41 - Bring method of determining IE version up to date (Closed)
Left Patch Set: Created June 21, 2014, 8:25 p.m.
Right Patch Set: Final (?) 2 Created Jan. 5, 2015, 1:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginClient.h" 3 #include "PluginClient.h"
4 #include "PluginSettings.h" 4 #include "PluginSettings.h"
5 #ifdef SUPPORT_CONFIG
6 #include "PluginConfig.h"
7 #endif
8 #include "PluginTab.h" 5 #include "PluginTab.h"
9 #include "PluginDomTraverser.h" 6 #include "AdblockPlusDomTraverser.h"
10 #include "PluginClass.h" 7 #include "PluginClass.h"
11
12 #include "PluginTabBase.h" 8 #include "PluginTabBase.h"
13 #include "PluginUtil.h" 9 #include "PluginUtil.h"
14 #include "../shared/Utils.h" 10 #include "../shared/IE_version.h"
15 #include <dispex.h> 11 #include <dispex.h>
12 #include <Mshtmhst.h>
16 13
17 int CPluginTabBase::s_dictionaryVersion = 0; 14 int CPluginTabBase::s_dictionaryVersion = 0;
18 int CPluginTabBase::s_settingsVersion = 1; 15 int CPluginTabBase::s_settingsVersion = 1;
19 #ifdef SUPPORT_FILTER
20 int CPluginTabBase::s_filterVersion = 0; 16 int CPluginTabBase::s_filterVersion = 0;
21 #endif
22 #ifdef SUPPORT_WHITELIST
23 int CPluginTabBase::s_whitelistVersion = 0; 17 int CPluginTabBase::s_whitelistVersion = 0;
24 #endif
25 #ifdef SUPPORT_CONFIG
26 int CPluginTabBase::s_configVersion = 0;
27 #endif
28
29 18
30 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) 19 CPluginTabBase::CPluginTabBase(CPluginClass* plugin)
31 : m_plugin(plugin) 20 : m_plugin(plugin)
32 , m_isActivated(false) 21 , m_isActivated(false)
33 , m_continueThreadRunning(true) 22 , m_continueThreadRunning(true)
34 { 23 {
35 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); 24 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter());
36 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); 25 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL);
37 26
38 CPluginClient* client = CPluginClient::GetInstance(); 27 CPluginClient* client = CPluginClient::GetInstance();
39 if ( ABP::IE::installed_major_version() < 10 ) 28 if (AdblockPlus::IE::InstalledMajorVersion() < 10)
40 { 29 {
41 m_isActivated = true; 30 m_isActivated = true;
42 } 31 }
43 32
44 try 33 try
45 { 34 {
46 m_thread = std::thread(&CPluginTabBase::ThreadProc, this); 35 m_thread = std::thread(&CPluginTabBase::ThreadProc, this);
47 } 36 }
48 catch (const std::system_error& ex) 37 catch (const std::system_error& ex)
49 { 38 {
50 std::wstring errDescription( L"Tab::Thread - Failed to create tab thread" ); 39 auto errDescription = std::string("Tab::Thread - Failed to create tab thread ") +
51 errDescription += ABP::debug::widen( ex.code().message() + ex.what() ); 40 ex.code().message() + ex.what();
52 DEBUG_ERROR_LOG( ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_TAB_TH READ_CREATE_PROCESS, errDescription ); 41 DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_TAB_THR EAD_CREATE_PROCESS, errDescription.c_str());
53 } 42 }
54
55 #ifdef SUPPORT_DOM_TRAVERSER
56 m_traverser = new CPluginDomTraverser(static_cast<CPluginTab*>(this)); 43 m_traverser = new CPluginDomTraverser(static_cast<CPluginTab*>(this));
57 #endif // SUPPORT_DOM_TRAVERSER
58 } 44 }
59 45
60 46
61 CPluginTabBase::~CPluginTabBase() 47 CPluginTabBase::~CPluginTabBase()
62 { 48 {
63 #ifdef SUPPORT_DOM_TRAVERSER
64 delete m_traverser; 49 delete m_traverser;
65 m_traverser = NULL; 50 m_traverser = NULL;
66 #endif // SUPPORT_DOM_TRAVERSER
67
68 m_continueThreadRunning = false; 51 m_continueThreadRunning = false;
69 if (m_thread.joinable()) { 52 if (m_thread.joinable()) {
70 m_thread.join(); 53 m_thread.join();
71 } 54 }
72 } 55 }
73 56
74 void CPluginTabBase::OnActivate() 57 void CPluginTabBase::OnActivate()
75 { 58 {
76 m_isActivated = true; 59 m_isActivated = true;
77 } 60 }
78 61
79 62
80 void CPluginTabBase::OnUpdate() 63 void CPluginTabBase::OnUpdate()
81 { 64 {
82 m_isActivated = true; 65 m_isActivated = true;
83 } 66 }
84 67
85 namespace 68 namespace
86 { 69 {
87 void FilterLoader(CPluginTabBase* tabBase) 70 void FilterLoader(CPluginTabBase* tabBase)
88 { 71 {
89 tabBase->m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementHid ingSelectors(tabBase->GetDocumentDomain())); 72 tabBase->m_filter->LoadHideFilters(CPluginClient::GetInstance()->GetElementH idingSelectors(tabBase->GetDocumentDomain()));
90 SetEvent(tabBase->m_filter->hideFiltersLoadedEvent); 73 SetEvent(tabBase->m_filter->hideFiltersLoadedEvent);
91 } 74 }
92 } 75 }
93 76
94 void CPluginTabBase::OnNavigate(const std::wstring & url) 77 void CPluginTabBase::OnNavigate(const CString& url)
95 { 78 {
96 SetDocumentUrl(url); 79 SetDocumentUrl(url);
97
98 #ifdef SUPPORT_FRAME_CACHING
99 ClearFrameCache(GetDocumentDomain()); 80 ClearFrameCache(GetDocumentDomain());
100 #endif
101
102 std::wstring domainString = GetDocumentDomain(); 81 std::wstring domainString = GetDocumentDomain();
103 ResetEvent(m_filter->hideFiltersLoadedEvent); 82 ResetEvent(m_filter->hideFiltersLoadedEvent);
104 try 83 try
105 { 84 {
106 std::thread filterLoaderThread(&FilterLoader, this); 85 std::thread filterLoaderThread(&FilterLoader, this);
107 filterLoaderThread.detach(); // TODO: but actually we should wait for the th read in the dtr. 86 filterLoaderThread.detach(); // TODO: but actually we should wait for the th read in the dtr.
108 } 87 }
109 catch (const std::system_error& ex) 88 catch (const std::system_error& ex)
110 { 89 {
111 std::wstring errDescription( L"Class::Thread - Failed to start filter loader thread, "); 90 auto errDescription = std::string("Class::Thread - Failed to start filter lo ader thread, ") +
112 errDescription += ABP::debug::widen( ex.code().message() + ex.what() ); 91 ex.code().message() + ex.what();
113 DEBUG_ERROR_LOG( ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_T HREAD_CREATE_PROCESS, errDescription ); 92 DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_TH READ_CREATE_PROCESS, errDescription.c_str());
114 } 93 }
115
116 #ifdef SUPPORT_DOM_TRAVERSER
117 m_traverser->ClearCache(); 94 m_traverser->ClearCache();
118 #endif
119 }
120
121 namespace {
122 } 95 }
123 96
124 void CPluginTabBase::InjectABP(IWebBrowser2* browser) 97 void CPluginTabBase::InjectABP(IWebBrowser2* browser)
125 { 98 {
126 CriticalSection::Lock lock(m_csInject); 99 CriticalSection::Lock lock(m_csInject);
127 std::wstring url = GetDocumentUrl(); 100 CString url = GetDocumentUrl();
128 101 CString log;
129 std::wostringstream log; 102 log.Format(L"InjectABP. Current URL: %s, settings URL: %s", url, UserSettingsF ileUrl().c_str());
130 log << L"InjectABP. Current URL: " << url << L", settings URL: " << UserSettin gsFileUrl(); 103 DEBUG_GENERAL(log);
131 DEBUG_GENERAL( log.str() ); 104 if (!(0 == url.CompareNoCase(CString(UserSettingsFileUrl().c_str())) ||
132 105 0 == url.CompareNoCase(CString(FirstRunPageFileUrl().c_str()))))
133 if( !ABP::util::wstring_equal_ci( url, UserSettingsFileUrl() )
134 && !ABP::util::wstring_equal_ci( url, FirstRunPageFileUrl() ) )
135 { 106 {
136 DEBUG_GENERAL(L"Not injecting"); 107 DEBUG_GENERAL(L"Not injecting");
137 return; 108 return;
138 } 109 }
139 DEBUG_GENERAL(L"Going to inject"); 110 DEBUG_GENERAL(L"Going to inject");
140 CComPtr<IDispatch> pDocDispatch; 111 CComPtr<IDispatch> pDocDispatch;
141 browser->get_Document(&pDocDispatch); 112 browser->get_Document(&pDocDispatch);
142 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch; 113 CComQIPtr<IHTMLDocument2> pDoc2 = pDocDispatch;
143 if (!pDoc2) 114 if (!pDoc2)
144 { 115 {
145 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE ATE_SETTINGS_JAVASCRIPT_INVOKE, L"CPluginTabBase::InjectABP - Failed to QI docum ent"); 116 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI docume nt");
146 return; 117 return;
147 } 118 }
148 CComPtr<IHTMLWindow2> pWnd2; 119 CComPtr<IHTMLWindow2> pWnd2;
149 pDoc2->get_parentWindow(&pWnd2); 120 pDoc2->get_parentWindow(&pWnd2);
150 if (!pWnd2) 121 if (!pWnd2)
151 { 122 {
152 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE ATE_SETTINGS_JAVASCRIPT_INVOKE, L"CPluginTabBase::InjectABP - Failed to get pare nt window"); 123 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to get paren t window");
153 return; 124 return;
154 } 125 }
155 CComQIPtr<IDispatchEx> pWndEx = pWnd2; 126 CComQIPtr<IDispatchEx> pWndEx = pWnd2;
156 if (!pWndEx) 127 if (!pWndEx)
157 { 128 {
158 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE ATE_SETTINGS_JAVASCRIPT_INVOKE, L"CPluginTabBase::InjectABP - Failed to QI dispa tch"); 129 DEBUG_ERROR_LOG(0, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CRE ATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to QI dispat ch");
159 return; 130 return;
160 } 131 }
161 // Create "Settings" object in JavaScript. 132 // Create "Settings" object in JavaScript.
162 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_plug inUserSettings 133 // A method call of "Settings" in JavaScript, transfered to "Invoke" of m_plug inUserSettings
163 DISPID dispid; 134 DISPID dispid;
164 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid); 135 HRESULT hr = pWndEx->GetDispID(L"Settings", fdexNameEnsure, &dispid);
165 if (FAILED(hr)) 136 if (FAILED(hr))
166 { 137 {
167 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR EATE_SETTINGS_JAVASCRIPT_INVOKE, L"CPluginTabBase::InjectABP - Failed to get dis patch"); 138 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR EATE_SETTINGS_JAVASCRIPT_INVOKE, "CPluginTabBase::InjectABP - Failed to get disp atch");
168 return; 139 return;
169 } 140 }
170 141 CComVariant var((IDispatch*)&m_pluginUserSettings);
171 DEBUG_GENERAL(L"Injecting"); 142
172 143 DEBUG_GENERAL("Injecting");
173 VARIANT var;
174 var.vt = VT_DISPATCH;
175 var.pdispVal = &m_pluginUserSettings;
176 144
177 DISPPARAMS params; 145 DISPPARAMS params;
178 params.cArgs = 1; 146 params.cArgs = 1;
179 params.cNamedArgs = 0; 147 params.cNamedArgs = 0;
180 params.rgvarg = &var; 148 params.rgvarg = &var;
181 params.rgdispidNamedArgs = 0; 149 params.rgdispidNamedArgs = 0;
182 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPU T | DISPATCH_PROPERTYPUTREF, &params, 0, 0, 0); 150 hr = pWndEx->Invoke(dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPU T | DISPATCH_PROPERTYPUTREF, &params, 0, 0, 0);
183 DEBUG_GENERAL(L"Invoke"); 151 DEBUG_GENERAL("Invoke");
184 if (FAILED(hr)) 152 if (FAILED(hr))
185 { 153 {
186 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_CREATE_SETTINGS_JAVASCRIPT, PLUGIN_ERROR_CR EATE_SETTINGS_JAVASCRIPT_INVOKE, L"CPluginTabBase::InjectABP - Failed to create Settings in JavaScript"); 154 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");
187 } 155 }
188 } 156 }
189 157
190 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) 158 void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser)
191 { 159 {
192 #ifdef SUPPORT_DOM_TRAVERSER 160 CPluginClient* client = CPluginClient::GetInstance();
193 if (!CPluginClient::GetInstance()->IsWhitelistedUrl(GetDocumentUrl())) 161 std::wstring url = to_wstring(GetDocumentUrl());
194 { 162 if (!client->IsWhitelistedUrl(url) && !client->IsElemhideWhitelistedOnDomain(u rl))
195 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl() .c_str()); 163 {
196 } 164 m_traverser->TraverseDocument(browser, GetDocumentDomain(), GetDocumentUrl() );
197 #endif // SUPPORT_DOM_TRAVERSER 165 }
198
199 InjectABP(browser); 166 InjectABP(browser);
200 } 167 }
201 168
202 void CPluginTabBase::OnDocumentComplete(IWebBrowser2* browser, const std::wstrin g url, bool isDocumentBrowser) 169 void CPluginTabBase::OnDocumentComplete(IWebBrowser2* browser, const CString& ur l, bool isDocumentBrowser)
203 { 170 {
204 std::wstring documentUrl = GetDocumentUrl(); 171 CString documentUrl = GetDocumentUrl();
205 172
206 if (isDocumentBrowser) 173 if (isDocumentBrowser)
207 { 174 {
208 if (url != documentUrl) 175 if (url != documentUrl)
209 { 176 {
210 SetDocumentUrl( url ); 177 SetDocumentUrl(url);
211 } 178 }
212 InjectABP(browser); 179 InjectABP(browser);
213 } 180 }
214 181 if (url.Left(6) != "res://")
215 #ifdef SUPPORT_DOM_TRAVERSER
216 if ( !ABP::util::begins_with( url, L"res://" ) )
217 { 182 {
218 // Get document 183 // Get document
219 CComPtr<IDispatch> pDocDispatch; 184 CComPtr<IDispatch> pDocDispatch;
220 HRESULT hr = browser->get_Document(&pDocDispatch); 185 HRESULT hr = browser->get_Document(&pDocDispatch);
221 if (FAILED(hr) || !pDocDispatch) 186 if (FAILED(hr) || !pDocDispatch)
222 { 187 {
223 return; 188 return;
224 } 189 }
225 190
226 CComQIPtr<IHTMLDocument2> pDoc = pDocDispatch; 191 CComQIPtr<IHTMLDocument2> pDoc = pDocDispatch;
(...skipping 10 matching lines...) Expand all
237 pOleObj->GetClientSite(&pClientSite); 202 pOleObj->GetClientSite(&pClientSite);
238 if (pClientSite != NULL) 203 if (pClientSite != NULL)
239 { 204 {
240 CComPtr<IDocHostUIHandler> docHostUIHandler; 205 CComPtr<IDocHostUIHandler> docHostUIHandler;
241 pClientSite->QueryInterface(IID_IDocHostUIHandler, (void**)&docHostUIHandl er); 206 pClientSite->QueryInterface(IID_IDocHostUIHandler, (void**)&docHostUIHandl er);
242 if (docHostUIHandler != NULL) 207 if (docHostUIHandler != NULL)
243 { 208 {
244 docHostUIHandler->UpdateUI(); 209 docHostUIHandler->UpdateUI();
245 } 210 }
246 } 211 }
247 212 }
248 pDoc.Release();
249 pDocDispatch.Release();
250 }
251 #endif
252 } 213 }
253 214
254 std::wstring CPluginTabBase::GetDocumentDomain() 215 std::wstring CPluginTabBase::GetDocumentDomain()
255 { 216 {
256 std::wstring domain; 217 std::wstring domain;
257 218
258 m_criticalSection.Lock(); 219 m_criticalSection.Lock();
259 { 220 {
260 domain = m_documentDomain; 221 domain = m_documentDomain;
261 } 222 }
262 m_criticalSection.Unlock(); 223 m_criticalSection.Unlock();
263 224
264 return domain; 225 return domain;
265 } 226 }
266 227
267 void CPluginTabBase::SetDocumentUrl(const std::wstring & url) 228 void CPluginTabBase::SetDocumentUrl(const CString& url)
268 { 229 {
269 m_criticalSection.Lock(); 230 m_criticalSection.Lock();
270 { 231 {
271 m_documentUrl = url; 232 m_documentUrl = url;
272 m_documentDomain = CAdblockPlusClient::GetInstance()->GetHostFromUrl(url); 233 m_documentDomain = CAdblockPlusClient::GetInstance()->GetHostFromUrl(to_wstr ing(url));
273 } 234 }
274 m_criticalSection.Unlock(); 235 m_criticalSection.Unlock();
275 } 236 }
276 237
277 std::wstring CPluginTabBase::GetDocumentUrl() 238 CString CPluginTabBase::GetDocumentUrl()
278 { 239 {
279 std::wstring url; 240 CString url;
280 241
281 m_criticalSection.Lock(); 242 m_criticalSection.Lock();
282 { 243 {
283 url = m_documentUrl; 244 url = m_documentUrl;
284 } 245 }
285 m_criticalSection.Unlock(); 246 m_criticalSection.Unlock();
286 247
287 return url; 248 return url;
288 } 249 }
289 250
290 251
291 // ============================================================================ 252 // ============================================================================
292 // Frame caching 253 // Frame caching
293 // ============================================================================ 254 // ============================================================================
294 255 bool CPluginTabBase::IsFrameCached(const CString& url)
295 #ifdef SUPPORT_FRAME_CACHING
296
297 bool CPluginTabBase::IsFrameCached(const std::wstring & url)
298 { 256 {
299 bool isFrame; 257 bool isFrame;
300 258
301 m_criticalSectionCache.Lock(); 259 m_criticalSectionCache.Lock();
302 { 260 {
303 isFrame = m_cacheFrames.find(url) != m_cacheFrames.end(); 261 isFrame = m_cacheFrames.find(url) != m_cacheFrames.end();
304 } 262 }
305 m_criticalSectionCache.Unlock(); 263 m_criticalSectionCache.Unlock();
306 264
307 return isFrame; 265 return isFrame;
308 } 266 }
309 267
310 void CPluginTabBase::CacheFrame(const std::wstring & url) 268 void CPluginTabBase::CacheFrame(const CString& url)
311 { 269 {
312 m_criticalSectionCache.Lock(); 270 m_criticalSectionCache.Lock();
313 { 271 {
314 m_cacheFrames.insert(url); 272 m_cacheFrames.insert(url);
315 } 273 }
316 m_criticalSectionCache.Unlock(); 274 m_criticalSectionCache.Unlock();
317 } 275 }
318 276
319 void CPluginTabBase::ClearFrameCache(const std::wstring & domain) 277 void CPluginTabBase::ClearFrameCache(const std::wstring& domain)
320 { 278 {
321 m_criticalSectionCache.Lock(); 279 m_criticalSectionCache.Lock();
322 { 280 {
323 if (domain.empty() || domain != m_cacheDomain) 281 if (domain.empty() || domain != m_cacheDomain)
324 { 282 {
325 m_cacheFrames.clear(); 283 m_cacheFrames.clear();
326 m_cacheDomain = domain; 284 m_cacheDomain = domain;
327 } 285 }
328 } 286 }
329 m_criticalSectionCache.Unlock(); 287 m_criticalSectionCache.Unlock();
330 } 288 }
331 289
332 #endif // SUPPORT_FRAME_CACHING
333
334
335 void CPluginTabBase::ThreadProc() 290 void CPluginTabBase::ThreadProc()
336 { 291 {
337 // Force loading/creation of settings 292 // Force loading/creation of settings
338 CPluginSettings* settings = CPluginSettings::GetInstance(); 293 CPluginSettings* settings = CPluginSettings::GetInstance();
339 294
340 settings->SetWorkingThreadId(); 295 settings->SetWorkingThreadId();
341 296
342 std::wostringstream thread_info; 297 CString threadInfo;
343 thread_info << ::GetCurrentProcessId() << L"." << ::GetCurrentThreadId(); 298 threadInfo.Format(L"%d.%d", ::GetCurrentProcessId(), ::GetCurrentThreadId());
344 299
345 std::wstring t[] = { 300 CString debugText;
346 L"========================================================================== ======", 301
347 L"TAB THREAD " + thread_info.str(), 302 debugText += L"=============================================================== =================";
348 L"========================================================================== ======", 303 debugText += L"\nTAB THREAD " + threadInfo;
349 }; 304 debugText += L"\n============================================================= ===================";
350 DEBUG_GENERAL(t); 305
306 DEBUG_GENERAL(debugText)
351 307
352 // -------------------------------------------------------------------- 308 // --------------------------------------------------------------------
353 // Tab loop 309 // Tab loop
354 // -------------------------------------------------------------------- 310 // --------------------------------------------------------------------
355 311
356 DWORD loopCount = 0; 312 DWORD loopCount = 0;
357 DWORD tabLoopIteration = 1; 313 DWORD tabLoopIteration = 1;
358 314
359 while (this->m_continueThreadRunning) 315 while (this->m_continueThreadRunning)
360 { 316 {
361 #ifdef ENABLE_DEBUG_THREAD 317 #ifdef ENABLE_DEBUG_THREAD
362 std::wostringstream message; 318 CStringA sTabLoopIteration;
363 message << L"Loop iteration " << tabLoopIteration; 319 sTabLoopIteration.Format("%u", tabLoopIteration);
364 DEBUG_THREAD( L"------------------------------------------------------------ --------------------" ); 320
365 DEBUG_THREAD( message.str() ); 321 DEBUG_THREAD("-------------------------------------------------------------- ------------------")
366 DEBUG_THREAD( L"------------------------------------------------------------ --------------------" ); 322 DEBUG_THREAD("Loop iteration " + sTabLoopIteration);
323 DEBUG_THREAD("-------------------------------------------------------------- ------------------")
367 #endif 324 #endif
368 if (this->m_isActivated) 325 if (this->m_isActivated)
369 { 326 {
370 bool isChanged = false; 327 bool isChanged = false;
371 328
372 if (isChanged) 329 if (isChanged)
373 { 330 {
374 this->m_plugin->UpdateStatusBar(); 331 this->m_plugin->UpdateStatusBar();
375 } 332 }
376 333
(...skipping 14 matching lines...) Expand all
391 CPluginClient::LogPluginError(pluginError.GetErrorCode(), pluginError. GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), tr ue, pluginError.GetProcessId(), pluginError.GetThreadId()); 348 CPluginClient::LogPluginError(pluginError.GetErrorCode(), pluginError. GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), tr ue, pluginError.GetProcessId(), pluginError.GetThreadId());
392 } 349 }
393 350
394 // Non-hanging sleep 351 // Non-hanging sleep
395 Sleep(50); 352 Sleep(50);
396 } 353 }
397 354
398 tabLoopIteration++; 355 tabLoopIteration++;
399 } 356 }
400 } 357 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld