Left: | ||
Right: |
OLD | NEW |
---|---|
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 | 19 |
20 #include "PluginClient.h" | 20 #include "PluginClient.h" |
21 #include "PluginSettings.h" | 21 #include "PluginSettings.h" |
22 #include "AdblockPlusDomTraverser.h" | 22 #include "AdblockPlusDomTraverser.h" |
23 #include "PluginClass.h" | 23 #include "PluginClass.h" |
24 #include "PluginTabBase.h" | 24 #include "PluginTabBase.h" |
25 #include "PluginUtil.h" | 25 #include "PluginUtil.h" |
26 #include "../shared/IE_version.h" | 26 #include "../shared/IE_version.h" |
27 #include <dispex.h> | 27 #include <dispex.h> |
28 #include <Mshtmhst.h> | 28 #include <Mshtmhst.h> |
29 | 29 |
30 int CPluginTabBase::s_dictionaryVersion = 0; | |
31 int CPluginTabBase::s_settingsVersion = 1; | |
32 int CPluginTabBase::s_filterVersion = 0; | |
33 int CPluginTabBase::s_whitelistVersion = 0; | |
34 | |
35 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) | 30 CPluginTabBase::CPluginTabBase(CPluginClass* plugin) |
36 : m_plugin(plugin) | 31 : m_plugin(plugin) |
37 , m_isActivated(false) | 32 , m_isActivated(false) |
38 , m_continueThreadRunning(true) | 33 , m_continueThreadRunning(true) |
39 { | 34 { |
40 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); | 35 m_filter = std::auto_ptr<CPluginFilter>(new CPluginFilter()); |
41 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); | 36 m_filter->hideFiltersLoadedEvent = CreateEvent(NULL, true, false, NULL); |
42 | 37 |
43 CPluginClient* client = CPluginClient::GetInstance(); | 38 CPluginClient* client = CPluginClient::GetInstance(); |
44 if (AdblockPlus::IE::InstalledMajorVersion() < 10) | 39 if (AdblockPlus::IE::InstalledMajorVersion() < 10) |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 { | 300 { |
306 if (domain.empty() || domain != m_cacheDomain) | 301 if (domain.empty() || domain != m_cacheDomain) |
307 { | 302 { |
308 m_cacheFrames.clear(); | 303 m_cacheFrames.clear(); |
309 m_cacheDomain = domain; | 304 m_cacheDomain = domain; |
310 } | 305 } |
311 } | 306 } |
312 m_criticalSectionCache.Unlock(); | 307 m_criticalSectionCache.Unlock(); |
313 } | 308 } |
314 | 309 |
310 /* | |
311 * TODO: Replace the management of the log queue in this thread within CPluginTa bBase | |
312 * with a version of the log queue that uses a single internal worker thre ad. | |
313 */ | |
Eric
2015/02/18 19:20:25
I put this comment into the change set because the
Oleksandr
2015/02/27 10:59:27
I'd vote for an issue instead of a TODO. Though I
Eric
2015/02/27 16:47:47
https://issues.adblockplus.org/ticket/2058
| |
315 void CPluginTabBase::ThreadProc() | 314 void CPluginTabBase::ThreadProc() |
316 { | 315 { |
317 // Force loading/creation of settings | 316 // Force loading/creation of settings |
318 CPluginSettings* settings = CPluginSettings::GetInstance(); | 317 CPluginSettings* settings = CPluginSettings::GetInstance(); |
319 | 318 |
320 settings->SetWorkingThreadId(); | 319 settings->SetWorkingThreadId(); |
321 | 320 |
322 CString threadInfo; | 321 CString threadInfo; |
323 threadInfo.Format(L"%d.%d", ::GetCurrentProcessId(), ::GetCurrentThreadId()); | 322 threadInfo.Format(L"%d.%d", ::GetCurrentProcessId(), ::GetCurrentThreadId()); |
324 | 323 |
(...skipping 15 matching lines...) Expand all Loading... | |
340 while (this->m_continueThreadRunning) | 339 while (this->m_continueThreadRunning) |
341 { | 340 { |
342 #ifdef ENABLE_DEBUG_THREAD | 341 #ifdef ENABLE_DEBUG_THREAD |
343 CStringA sTabLoopIteration; | 342 CStringA sTabLoopIteration; |
344 sTabLoopIteration.Format("%u", tabLoopIteration); | 343 sTabLoopIteration.Format("%u", tabLoopIteration); |
345 | 344 |
346 DEBUG_THREAD("-------------------------------------------------------------- ------------------") | 345 DEBUG_THREAD("-------------------------------------------------------------- ------------------") |
347 DEBUG_THREAD("Loop iteration " + sTabLoopIteration); | 346 DEBUG_THREAD("Loop iteration " + sTabLoopIteration); |
348 DEBUG_THREAD("-------------------------------------------------------------- ------------------") | 347 DEBUG_THREAD("-------------------------------------------------------------- ------------------") |
349 #endif | 348 #endif |
350 if (this->m_isActivated) | 349 this->m_isActivated = false; |
351 { | |
352 bool isChanged = false; | |
353 | |
354 if (isChanged) | |
355 { | |
356 this->m_plugin->UpdateStatusBar(); | |
357 } | |
358 | |
359 this->m_isActivated = false; | |
360 } | |
Eric
2015/02/18 19:20:25
I don't know where this code came from originally,
Oleksandr
2015/02/27 10:59:27
Let's just say there was a lot of optimization hap
Eric
2015/02/27 16:47:47
I promise I won't bookmark this URL and pull it ou
| |
361 | 350 |
362 // -------------------------------------------------------------------- | 351 // -------------------------------------------------------------------- |
363 // End loop | 352 // End loop |
364 // -------------------------------------------------------------------- | 353 // -------------------------------------------------------------------- |
365 | 354 |
366 // Sleep loop | 355 // Sleep loop |
367 while (this->m_continueThreadRunning && !this->m_isActivated && (++loopCou nt % (TIMER_THREAD_SLEEP_TAB_LOOP / 50)) != 0) | 356 while (this->m_continueThreadRunning && !this->m_isActivated && (++loopCou nt % (TIMER_THREAD_SLEEP_TAB_LOOP / 50)) != 0) |
368 { | 357 { |
369 // Post async plugin error | 358 // Post async plugin error |
370 CPluginError pluginError; | 359 CPluginError pluginError; |
371 if (CPluginClient::PopFirstPluginError(pluginError)) | 360 if (LogQueue::PopFirstPluginError(pluginError)) |
372 { | 361 { |
373 CPluginClient::LogPluginError(pluginError.GetErrorCode(), pluginError. GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), tr ue, pluginError.GetProcessId(), pluginError.GetThreadId()); | 362 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId()); |
374 } | 363 } |
375 | 364 |
376 // Non-hanging sleep | 365 // Non-hanging sleep |
377 Sleep(50); | 366 Sleep(50); |
378 } | 367 } |
379 | 368 |
380 tabLoopIteration++; | 369 tabLoopIteration++; |
381 } | 370 } |
382 } | 371 } |
OLD | NEW |