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

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

Issue 5747779603267584: Issue #1234 - Rework strings in debug facility (Closed)
Patch Set: Created Feb. 24, 2015, 2:50 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
OLDNEW
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 10 matching lines...) Expand all
21 class CPluginClientFactory; 21 class CPluginClientFactory;
22 22
23 class CPluginError 23 class CPluginError
24 { 24 {
25 25
26 private: 26 private:
27 27
28 int m_errorId; 28 int m_errorId;
29 int m_errorSubid; 29 int m_errorSubid;
30 DWORD m_errorCode; 30 DWORD m_errorCode;
31 CString m_errorDescription; 31 std::string m_errorDescription;
32 DWORD m_processId; 32 DWORD m_processId;
33 DWORD m_threadId; 33 DWORD m_threadId;
34 34
35 public: 35 public:
36 36
37 CPluginError(int errorId, int errorSubid, DWORD errorCode, const CString& erro rDesc) : 37 CPluginError(int errorId, int errorSubid, DWORD errorCode, const std::string& errorDesc) :
38 m_errorId(errorId), m_errorSubid(errorSubid), m_errorCode(errorCode), m_erro rDescription(errorDesc) 38 m_errorId(errorId), m_errorSubid(errorSubid), m_errorCode(errorCode), m_erro rDescription(errorDesc)
39 { 39 {
40 m_processId = ::GetCurrentProcessId(); 40 m_processId = ::GetCurrentProcessId();
41 m_threadId = ::GetCurrentThreadId(); 41 m_threadId = ::GetCurrentThreadId();
42 } 42 }
43 43
44 CPluginError() : 44 CPluginError() :
45 m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0) {} 45 m_errorId(0), m_errorSubid(0), m_errorCode(0), m_processId(0), m_threadId(0) {}
46 46
47 CPluginError(const CPluginError& org) : 47 CPluginError(const CPluginError& org) :
48 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) {} 48 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 49
50 int GetErrorId() const { return m_errorId; } 50 int GetErrorId() const { return m_errorId; }
51 int GetErrorSubid() const { return m_errorSubid; } 51 int GetErrorSubid() const { return m_errorSubid; }
52 DWORD GetErrorCode() const { return m_errorCode; } 52 DWORD GetErrorCode() const { return m_errorCode; }
53 CString GetErrorDescription() const { return m_errorDescription; } 53 std::string GetErrorDescription() const { return m_errorDescription; }
54 DWORD GetProcessId() const { return m_processId; } 54 DWORD GetProcessId() const { return m_processId; }
55 DWORD GetThreadId() const { return m_threadId; } 55 DWORD GetThreadId() const { return m_threadId; }
56 }; 56 };
57 57
58 58
59 class CPluginClientBase 59 class CPluginClientBase
60 { 60 {
61 friend class CPluginClientFactory; 61 friend class CPluginClientFactory;
62 62
63 private: 63 private:
64 64
65 static std::vector<CPluginError> s_pluginErrors; 65 static std::vector<CPluginError> s_pluginErrors;
66 66
67 static bool s_isErrorLogging; 67 static bool s_isErrorLogging;
68 68
69 protected: 69 protected:
70 70
71 // Protected constructor used by the singleton pattern 71 // Protected constructor used by the singleton pattern
72 CPluginClientBase(); 72 CPluginClientBase();
73 73
74 static CComAutoCriticalSection s_criticalSectionLocal; 74 static CComAutoCriticalSection s_criticalSectionLocal;
75 75
76 public: 76 public:
77 77
78 ~CPluginClientBase(); 78 ~CPluginClientBase();
79 79
80 static void SetLocalization(); 80 static void SetLocalization();
81 81
82 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const CString& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwThrea dId=0); 82 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const std::string& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwT hreadId=0);
83 83
84 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons t CString& errorDescription); 84 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons t std::string& errorDescription);
85 static bool PopFirstPluginError(CPluginError& pluginError); 85 static bool PopFirstPluginError(CPluginError& pluginError);
86 }; 86 };
87 87
88 /** 88 /**
89 * Wrapper around Microsoft API 'UrlUnescape' 89 * Wrapper around Microsoft API 'UrlUnescape'
90 * 90 *
91 * This function has modify-in-place semantics. 91 * This function has modify-in-place semantics.
92 * This behavior matches that of the legacy version of this function declared ab ove. 92 * This behavior matches that of the legacy version of this function declared ab ove.
93 * At present, callers of this function have no code to handle error conditions that might arise here. 93 * At present, callers of this function have no code to handle error conditions that might arise here.
94 * Because there's no error handling, therefore, this masks failures in UrlUnesc ape. 94 * Because there's no error handling, therefore, this masks failures in UrlUnesc ape.
95 */ 95 */
96 void UnescapeUrl(std::wstring& url); 96 void UnescapeUrl(std::wstring& url);
97 97
98 #endif // _PLUGIN_CLIENT_BASE_H_ 98 #endif // _PLUGIN_CLIENT_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld