| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | |
| 4 * | |
| 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 | |
| 7 * published by the Free Software Foundation. | |
| 8 * | |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12 * GNU General Public License for more details. | |
| 13 * | |
| 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/>. | |
| 16 */ | |
| 17 | |
| 18 #ifndef _PLUGIN_CLIENT_BASE_H_ | |
| 19 #define _PLUGIN_CLIENT_BASE_H_ | |
| 20 | |
| 21 #include <vector> | |
| 22 #include "ATL_Deprecate.h" | |
| 23 | |
| 24 class CPluginError | |
| 25 { | |
| 26 | |
| 27 private: | |
| 28 | |
| 29 int m_errorId; | |
| 30 int m_errorSubid; | |
| 31 DWORD m_errorCode; | |
| 32 std::string m_errorDescription; | |
| 33 DWORD m_processId; | |
| 34 DWORD m_threadId; | |
| 35 | |
| 36 public: | |
| 37 | |
| 38 CPluginError(int errorId, int errorSubid, DWORD errorCode, const std::string&
errorDesc) : | |
| 39 m_errorId(errorId), m_errorSubid(errorSubid), m_errorCode(errorCode), m_erro
rDescription(errorDesc) | |
| 40 { | |
| 41 m_processId = ::GetCurrentProcessId(); | |
| 42 m_threadId = ::GetCurrentThreadId(); | |
| 43 } | |
| 44 | |
| 45 CPluginError() : | |
| 46 m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0)
{} | |
| 47 | |
| 48 CPluginError(const CPluginError& org) : | |
| 49 m_errorId(org.m_errorId), m_errorSubid(org.m_errorSubid), m_errorCode(org.m_
errorCode), m_errorDescription(org.m_errorDescription), m_processId(org.m_proces
sId), m_threadId(org.m_threadId) {} | |
| 50 | |
| 51 int GetErrorId() const { return m_errorId; } | |
| 52 int GetErrorSubid() const { return m_errorSubid; } | |
| 53 DWORD GetErrorCode() const { return m_errorCode; } | |
| 54 std::string GetErrorDescription() const { return m_errorDescription; } | |
| 55 DWORD GetProcessId() const { return m_processId; } | |
| 56 DWORD GetThreadId() const { return m_threadId; } | |
| 57 }; | |
| 58 | |
| 59 | |
| 60 class LogQueue | |
| 61 { | |
| 62 private: | |
| 63 static std::vector<CPluginError> s_pluginErrors; | |
| 64 static CComAutoCriticalSection s_criticalSectionQueue; | |
| 65 | |
| 66 public: | |
| 67 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const
std::string& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwT
hreadId=0); | |
| 68 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons
t std::string& errorDescription); | |
| 69 static bool PopFirstPluginError(CPluginError& pluginError); | |
| 70 }; | |
| 71 | |
| 72 #endif // _PLUGIN_CLIENT_BASE_H_ | |
| OLD | NEW |