summaryrefslogtreecommitdiff
path: root/include/desktop
diff options
context:
space:
mode:
authorJuergen Funk <juergen.funk_ml@cib.de>2019-09-25 13:49:26 +0200
committerJuergen Funk (CIB) <juergen.funk_ml@cib.de>2019-10-02 07:10:50 +0200
commit8fe03eef707561bb0b9e1655292619ec3cd347f5 (patch)
tree8cfd6d8f86f0b82e93c42bef9d96f9221d019ae6 /include/desktop
parentd09dc224977c498356ab76738afe03136c98fabe (diff)
Refactoring of the class CrashReporter
- remove double code - using of all the methode of the CrashReporter-Class - all methode only active when crash-dump enable except the addKeyValue With this change the handling for the patch tdf#127711 A runtime-switch for the MiniCrashDump would be simpler Change-Id: I339b3b8e06f7fc2cd3c0d34ece112a6fd352913a Reviewed-on: https://gerrit.libreoffice.org/79272 Tested-by: Jenkins Reviewed-by: Juergen Funk (CIB) <juergen.funk_ml@cib.de>
Diffstat (limited to 'include/desktop')
-rw-r--r--include/desktop/crashreport.hxx59
-rw-r--r--include/desktop/minidump.hxx13
2 files changed, 47 insertions, 25 deletions
diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx
index e3486bbf0863..3af83b8e637c 100644
--- a/include/desktop/crashreport.hxx
+++ b/include/desktop/crashreport.hxx
@@ -17,7 +17,8 @@
#include <config_features.h>
-#include <map>
+// vector not sort the entries
+#include <vector>
#include <string>
namespace google_breakpad
@@ -41,40 +42,50 @@ CRASHREPORT_DLLPUBLIC
/*class*/ CrashReporter
{
public:
- static void addKeyValue(const OUString& rKey, const OUString& rValue);
-
- static std::string getIniFileName();
-
- static void writeCommonInfo();
+ typedef enum {AddItem, Write, Create} tAddKeyHandling;
+#if HAVE_FEATURE_BREAKPAD
+ static void addKeyValue(const OUString& rKey, const OUString& rValue, tAddKeyHandling AddKeyHandling);
static void storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler);
- // when we create the ExceptionHandler we have no access to the user
- // profile yet, so update when we have access
- static void updateMinidumpLocation();
+ static bool crashReportInfoExists();
-private:
+ static bool readSendConfig(std::string& response);
+private:
static osl::Mutex maMutex;
-
static bool mbInit;
-
- static std::map<OUString, OUString> maKeyValues; // used to temporarily save entries before the old info has been uploaded
+ typedef struct _mpair
+ {
+ OUString first;
+ OUString second;
+ _mpair(const OUString& First, const OUString& Second)
+ {
+ first = First;
+ second = Second;
+ };
+ } mpair;
+
+ typedef std::vector<mpair> vmaKeyValues;
+ static vmaKeyValues maKeyValues; // used to temporarily save entries before the old info has been uploaded
static google_breakpad::ExceptionHandler* mpExceptionHandler;
-};
-// Add dummy methods for the non-breakpad case. That allows us to use
-// the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
-// everywhere we want to log something to the crash report system.
-#if HAVE_FEATURE_BREAKPAD
-#else
-inline void CrashReporter::addKeyValue(SAL_UNUSED_PARAMETER const OUString& /*rKey*/, SAL_UNUSED_PARAMETER const OUString& /*rValue*/)
-{
-}
-#endif
+ static std::string getIniFileName();
+ static void writeCommonInfo();
+ static void writeToFile(std::ios_base::openmode Openmode);
+ // when we create the ExceptionHandler we have no access to the user
+ // profile yet, so update when we have access
+ static void updateMinidumpLocation();
+#else
+ // Add dummy methods for the non-breakpad case. That allows us to use
+ // // the code without linking to the lib and without adding HAVE_FEATURE_BREAKPAD
+ // // everywhere we want to log something to the crash report system.
+ inline static void addKeyValue(SAL_UNUSED_PARAMETER const OUString& /*rKey*/, SAL_UNUSED_PARAMETER const OUString& /*rValue*/, SAL_UNUSED_PARAMETER tAddKeyHandling /*AddKeyHandling*/) {};
+#endif // HAVE_FEATURE_BREAKPAD
+};
-#endif
+#endif // INCLUDED_DESKTOP_CRASHREPORT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/desktop/minidump.hxx b/include/desktop/minidump.hxx
index 63336cae5595..6ed0e18277f8 100644
--- a/include/desktop/minidump.hxx
+++ b/include/desktop/minidump.hxx
@@ -16,7 +16,18 @@
namespace crashreport {
-CRASHREPORT_DLLPUBLIC bool readConfig(const std::string& iniPath, std::string& response);
+// when response = nullptr only make test
+/** Read+Send, Test and send info from the Dump.ini .
+
+ @param [in] iniPath Path-file to the read/test ini-file
+ @param [in] response=nullptr in this case made the Test only
+ @param [in] response!=nullptr in this case made the Read+Send
+
+ @retval true Read+Send, Test was okay
+ @retval false Read+Send, Test is a error
+*/
+
+CRASHREPORT_DLLPUBLIC bool readConfig(const std::string& iniPath, std::string * response);
}