| Left: | ||
| Right: |
| 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 | 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 } | 311 } |
| 317 | 312 |
| 318 void CPluginTabBase::ThreadProc() | 313 void CPluginTabBase::ThreadProc() |
| 319 { | 314 { |
| 320 // Force loading/creation of settings | 315 // Force loading/creation of settings |
| 321 CPluginSettings::GetInstance()->SetWorkingThreadId(); | 316 CPluginSettings::GetInstance()->SetWorkingThreadId(); |
| 322 | 317 |
| 323 std::string message = | 318 std::string message = |
| 324 "=========================================================================== =====\n" | 319 "=========================================================================== =====\n" |
| 325 "TAB THREAD process="; | 320 "TAB THREAD process="; |
| 326 message += std::to_string( ::GetCurrentProcessId() ); | 321 message += std::to_string(::GetCurrentProcessId()); |
|
sergei
2015/02/25 13:53:31
here and below additional spaces
Eric
2015/02/25 15:24:46
Done.
| |
| 327 message + " thread="; | 322 message + " thread="; |
| 328 message += std::to_string( ::GetCurrentThreadId() ); | 323 message += std::to_string(::GetCurrentThreadId()); |
| 329 message += | 324 message += |
| 330 "\n" | 325 "\n" |
| 331 "=========================================================================== ====="; | 326 "=========================================================================== ====="; |
| 332 DEBUG_GENERAL(message); | 327 DEBUG_GENERAL(message); |
| 333 | 328 |
| 334 // -------------------------------------------------------------------- | 329 // -------------------------------------------------------------------- |
| 335 // Tab loop | 330 // Tab loop |
| 336 // -------------------------------------------------------------------- | 331 // -------------------------------------------------------------------- |
| 337 | 332 |
| 338 DWORD loopCount = 0; | 333 DWORD loopCount = 0; |
| 339 DWORD tabLoopIteration = 1; | 334 DWORD tabLoopIteration = 1; |
| 340 | 335 |
| 341 while (this->m_continueThreadRunning) | 336 while (this->m_continueThreadRunning) |
| 342 { | 337 { |
| 343 #ifdef ENABLE_DEBUG_THREAD | 338 #ifdef ENABLE_DEBUG_THREAD |
| 344 CStringA sTabLoopIteration; | 339 CStringA sTabLoopIteration; |
| 345 sTabLoopIteration.Format("%u", tabLoopIteration); | 340 sTabLoopIteration.Format("%u", tabLoopIteration); |
| 346 | 341 |
| 347 DEBUG_THREAD("-------------------------------------------------------------- ------------------") | 342 DEBUG_THREAD("-------------------------------------------------------------- ------------------") |
| 348 DEBUG_THREAD("Loop iteration " + sTabLoopIteration); | 343 DEBUG_THREAD("Loop iteration " + sTabLoopIteration); |
| 349 DEBUG_THREAD("-------------------------------------------------------------- ------------------") | 344 DEBUG_THREAD("-------------------------------------------------------------- ------------------") |
| 350 #endif | 345 #endif |
| 351 if (this->m_isActivated) | 346 this->m_isActivated = false; |
| 352 { | |
| 353 bool isChanged = false; | |
| 354 | |
| 355 if (isChanged) | |
| 356 { | |
| 357 this->m_plugin->UpdateStatusBar(); | |
| 358 } | |
| 359 | |
| 360 this->m_isActivated = false; | |
| 361 } | |
| 362 | 347 |
| 363 // -------------------------------------------------------------------- | 348 // -------------------------------------------------------------------- |
| 364 // End loop | 349 // End loop |
| 365 // -------------------------------------------------------------------- | 350 // -------------------------------------------------------------------- |
| 366 | 351 |
| 367 // Sleep loop | 352 // Sleep loop |
| 368 while (this->m_continueThreadRunning && !this->m_isActivated && (++loopCou nt % (TIMER_THREAD_SLEEP_TAB_LOOP / 50)) != 0) | 353 while (this->m_continueThreadRunning && !this->m_isActivated && (++loopCou nt % (TIMER_THREAD_SLEEP_TAB_LOOP / 50)) != 0) |
| 369 { | 354 { |
| 370 // Post async plugin error | 355 // Post async plugin error |
| 371 CPluginError pluginError; | 356 CPluginError pluginError; |
| 372 if (CPluginClient::PopFirstPluginError(pluginError)) | 357 if (LogQueue::PopFirstPluginError(pluginError)) |
| 373 { | 358 { |
| 374 CPluginClient::LogPluginError(pluginError.GetErrorCode(), pluginError. GetErrorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), tr ue, pluginError.GetProcessId(), pluginError.GetThreadId()); | 359 LogQueue::LogPluginError(pluginError.GetErrorCode(), pluginError.GetEr rorId(), pluginError.GetErrorSubid(), pluginError.GetErrorDescription(), true, p luginError.GetProcessId(), pluginError.GetThreadId()); |
| 375 } | 360 } |
| 376 | 361 |
| 377 // Non-hanging sleep | 362 // Non-hanging sleep |
| 378 Sleep(50); | 363 Sleep(50); |
| 379 } | 364 } |
| 380 | 365 |
| 381 tabLoopIteration++; | 366 tabLoopIteration++; |
| 382 } | 367 } |
| 383 } | 368 } |
| LEFT | RIGHT |