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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "ATL_Deprecate.h" | 22 #include "ATL_Deprecate.h" |
23 | 23 |
24 class CPluginError | 24 class CPluginError |
25 { | 25 { |
26 | 26 |
27 private: | 27 private: |
28 | 28 |
29 int m_errorId; | 29 int m_errorId; |
30 int m_errorSubid; | 30 int m_errorSubid; |
31 DWORD m_errorCode; | 31 DWORD m_errorCode; |
32 CString m_errorDescription; | 32 std::string m_errorDescription; |
33 DWORD m_processId; | 33 DWORD m_processId; |
34 DWORD m_threadId; | 34 DWORD m_threadId; |
35 | 35 |
36 public: | 36 public: |
37 | 37 |
38 CPluginError(int errorId, int errorSubid, DWORD errorCode, const CString& erro
rDesc) : | 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) | 39 m_errorId(errorId), m_errorSubid(errorSubid), m_errorCode(errorCode), m_erro
rDescription(errorDesc) |
40 { | 40 { |
41 m_processId = ::GetCurrentProcessId(); | 41 m_processId = ::GetCurrentProcessId(); |
42 m_threadId = ::GetCurrentThreadId(); | 42 m_threadId = ::GetCurrentThreadId(); |
43 } | 43 } |
44 | 44 |
45 CPluginError() : | 45 CPluginError() : |
46 m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0)
{} | 46 m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0)
{} |
47 | 47 |
48 CPluginError(const CPluginError& org) : | 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) {} | 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 | 50 |
51 int GetErrorId() const { return m_errorId; } | 51 int GetErrorId() const { return m_errorId; } |
52 int GetErrorSubid() const { return m_errorSubid; } | 52 int GetErrorSubid() const { return m_errorSubid; } |
53 DWORD GetErrorCode() const { return m_errorCode; } | 53 DWORD GetErrorCode() const { return m_errorCode; } |
54 CString GetErrorDescription() const { return m_errorDescription; } | 54 std::string GetErrorDescription() const { return m_errorDescription; } |
55 DWORD GetProcessId() const { return m_processId; } | 55 DWORD GetProcessId() const { return m_processId; } |
56 DWORD GetThreadId() const { return m_threadId; } | 56 DWORD GetThreadId() const { return m_threadId; } |
57 }; | 57 }; |
58 | 58 |
59 | 59 |
60 class LogQueue | 60 class LogQueue |
61 { | 61 { |
62 private: | 62 private: |
63 static std::vector<CPluginError> s_pluginErrors; | 63 static std::vector<CPluginError> s_pluginErrors; |
64 static CComAutoCriticalSection s_criticalSectionQueue; | 64 static CComAutoCriticalSection s_criticalSectionQueue; |
65 | 65 |
66 public: | 66 public: |
67 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const
CString& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwThrea
dId=0); | 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 CString& errorDescription); | 68 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons
t std::string& errorDescription); |
69 static bool PopFirstPluginError(CPluginError& pluginError); | 69 static bool PopFirstPluginError(CPluginError& pluginError); |
70 }; | 70 }; |
71 | 71 |
72 /** | 72 /** |
73 * Wrapper around Microsoft API 'UrlUnescape' | 73 * Wrapper around Microsoft API 'UrlUnescape' |
74 * | 74 * |
75 * This function has modify-in-place semantics. | 75 * This function has modify-in-place semantics. |
76 * This behavior matches that of the legacy version of this function declared ab
ove. | 76 * This behavior matches that of the legacy version of this function declared ab
ove. |
77 * At present, callers of this function have no code to handle error conditions
that might arise here. | 77 * At present, callers of this function have no code to handle error conditions
that might arise here. |
78 * Because there's no error handling, therefore, this masks failures in UrlUnesc
ape. | 78 * Because there's no error handling, therefore, this masks failures in UrlUnesc
ape. |
79 */ | 79 */ |
80 void UnescapeUrl(std::wstring& url); | 80 void UnescapeUrl(std::wstring& url); |
81 | 81 |
82 #endif // _PLUGIN_CLIENT_BASE_H_ | 82 #endif // _PLUGIN_CLIENT_BASE_H_ |
OLD | NEW |