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

Side by Side Diff: src/plugin/PluginClientBase.h

Issue 29323611: Issue #1234, #2058 - Rewrite log facility, improving thread implementation
Patch Set: rebase only Created July 27, 2016, 9:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginClass.cpp ('k') | src/plugin/PluginClientBase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 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_
OLDNEW
« no previous file with comments | « src/plugin/PluginClass.cpp ('k') | src/plugin/PluginClientBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld