Use FilePath for crash reporter temp directory
authorKevin Sawicki <kevinsawicki@gmail.com>
Wed, 5 Oct 2016 23:40:19 +0000 (16:40 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Thu, 6 Oct 2016 16:02:03 +0000 (09:02 -0700)
atom/common/crash_reporter/crash_reporter.cc
atom/common/crash_reporter/crash_reporter.h
atom/common/crash_reporter/crash_reporter_linux.cc
atom/common/crash_reporter/crash_reporter_linux.h
atom/common/crash_reporter/crash_reporter_mac.h
atom/common/crash_reporter/crash_reporter_mac.mm
atom/common/crash_reporter/crash_reporter_win.cc
atom/common/crash_reporter/crash_reporter_win.h

index 2506e28..5b621c7 100644 (file)
@@ -25,19 +25,19 @@ CrashReporter::~CrashReporter() {
 void CrashReporter::Start(const std::string& product_name,
                           const std::string& company_name,
                           const std::string& submit_url,
-                          const std::string& temp_dir,
+                          const base::FilePath& temp_path,
                           bool auto_submit,
                           bool skip_system_crash_handler,
                           const StringMap& extra_parameters) {
   SetUploadParameters(extra_parameters);
 
   InitBreakpad(product_name, ATOM_VERSION_STRING, company_name, submit_url,
-               temp_dir, auto_submit, skip_system_crash_handler);
+               temp_path, auto_submit, skip_system_crash_handler);
 }
 
 base::FilePath CrashReporter::GetCrashesDirectory(
-    const std::string& product_name, const std::string& temp_dir) {
-  return base::FilePath(temp_dir).Append(product_name + " Crashes");
+    const std::string& product_name, const base::FilePath& temp_path) {
+  return temp_path.Append(product_name + " Crashes");
 }
 
 void CrashReporter::SetUploadParameters(const StringMap& parameters) {
@@ -50,11 +50,12 @@ void CrashReporter::SetUploadParameters(const StringMap& parameters) {
 
 std::vector<CrashReporter::UploadReportResult>
 CrashReporter::GetUploadedReports(const std::string& product_name,
-                                  const std::string& temp_dir) {
+                                  const base::FilePath& temp_path) {
   std::vector<CrashReporter::UploadReportResult> result;
 
   base::FilePath uploads_path =
-      GetCrashesDirectory(product_name, temp_dir).Append("uploads.log");
+      GetCrashesDirectory(product_name, temp_path)
+          .Append(FILE_PATH_LITERAL("uploads.log"));
   std::string file_content;
   if (base::ReadFileToString(uploads_path, &file_content)) {
     std::vector<std::string> reports = base::SplitString(
@@ -77,7 +78,7 @@ void CrashReporter::InitBreakpad(const std::string& product_name,
                                  const std::string& version,
                                  const std::string& company_name,
                                  const std::string& submit_url,
-                                 const std::string& temp_dir,
+                                 const base::FilePath& temp_path,
                                  bool auto_submit,
                                  bool skip_system_crash_handler) {
 }
index b154a8d..9738924 100644 (file)
@@ -25,17 +25,17 @@ class CrashReporter {
   void Start(const std::string& product_name,
              const std::string& company_name,
              const std::string& submit_url,
-             const std::string& temp_dir,
+             const base::FilePath& temp_path,
              bool auto_submit,
              bool skip_system_crash_handler,
              const StringMap& extra_parameters);
 
   virtual std::vector<CrashReporter::UploadReportResult> GetUploadedReports(
       const std::string& product_name,
-      const std::string& temp_dir);
+      const base::FilePath& temp_path);
 
   base::FilePath GetCrashesDirectory(const std::string& product_name,
-                                     const std::string& temp_dir);
+                                     const base::FilePath& temp_path);
 
  protected:
   CrashReporter();
@@ -45,7 +45,7 @@ class CrashReporter {
                             const std::string& version,
                             const std::string& company_name,
                             const std::string& submit_url,
-                            const std::string& temp_dir,
+                            const base::FilePath& temp_path,
                             bool auto_submit,
                             bool skip_system_crash_handler);
   virtual void SetUploadParameters();
index e2f4c80..c670d91 100644 (file)
@@ -60,10 +60,10 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
                                       const std::string& version,
                                       const std::string& company_name,
                                       const std::string& submit_url,
-                                      const std::string& temp_dir,
+                                      const base::FilePath& temp_path,
                                       bool auto_submit,
                                       bool skip_system_crash_handler) {
-  EnableCrashDumping(product_name, temp_dir);
+  EnableCrashDumping(product_name, temp_path);
 
   crash_keys_.SetKeyValue("prod", ATOM_PRODUCT_NAME);
   crash_keys_.SetKeyValue("ver", version.c_str());
@@ -79,8 +79,8 @@ void CrashReporterLinux::SetUploadParameters() {
 }
 
 void CrashReporterLinux::EnableCrashDumping(const std::string& product_name,
-                                            const std::string& temp_dir) {
-  base::FilePath dumps_path = GetCrashesDirectory(product_name, temp_dir);
+                                            const base::FilePath& temp_path) {
+  base::FilePath dumps_path = GetCrashesDirectory(product_name, temp_path);
   base::CreateDirectory(dumps_path);
 
   std::string log_file = base::StringPrintf(
index f87ae8c..8e4fb76 100644 (file)
@@ -31,7 +31,7 @@ class CrashReporterLinux : public CrashReporter {
                     const std::string& version,
                     const std::string& company_name,
                     const std::string& submit_url,
-                    const std::string& temp_dir,
+                    const base::FilePath& temp_path,
                     bool auto_submit,
                     bool skip_system_crash_handler) override;
   void SetUploadParameters() override;
@@ -43,7 +43,7 @@ class CrashReporterLinux : public CrashReporter {
   virtual ~CrashReporterLinux();
 
   void EnableCrashDumping(const std::string& product_name,
-                          const std::string& temp_dir);
+                          const base::FilePath& temp_path);
 
   static bool CrashDone(const google_breakpad::MinidumpDescriptor& minidump,
                         void* context,
index 2cf189f..a042799 100644 (file)
@@ -27,7 +27,7 @@ class CrashReporterMac : public CrashReporter {
                     const std::string& version,
                     const std::string& company_name,
                     const std::string& submit_url,
-                    const std::string& temp_dir,
+                    const base::FilePath& temp_path,
                     bool auto_submit,
                     bool skip_system_crash_handler) override;
   void SetUploadParameters() override;
@@ -43,7 +43,7 @@ class CrashReporterMac : public CrashReporter {
                         const base::StringPiece& value);
 
   std::vector<UploadReportResult> GetUploadedReports(
-      const std::string& path, const std::string& temp_dir) override;
+      const std::string& path, const base::FilePath& temp_path) override;
 
   std::unique_ptr<crashpad::SimpleStringDictionary> simple_string_dictionary_;
 
index 071c4fd..19e59ca 100644 (file)
@@ -31,7 +31,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
                                     const std::string& version,
                                     const std::string& company_name,
                                     const std::string& submit_url,
-                                    const std::string& temp_dir,
+                                    const base::FilePath& temp_path,
                                     bool auto_submit,
                                     bool skip_system_crash_handler) {
   // check whether crashpad has been initialized.
@@ -39,7 +39,7 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
   if (simple_string_dictionary_)
     return;
 
-  base::FilePath database_path = GetCrashesDirectory(product_name, temp_dir);
+  base::FilePath database_path = GetCrashesDirectory(product_name, temp_path);
   if (is_browser_) {
     @autoreleasepool {
       base::FilePath framework_bundle_path = base::mac::FrameworkBundlePath();
@@ -94,10 +94,10 @@ void CrashReporterMac::SetCrashKeyValue(const base::StringPiece& key,
 
 std::vector<CrashReporter::UploadReportResult>
 CrashReporterMac::GetUploadedReports(const std::string& product_name,
-                                     const std::string& temp_dir) {
+                                     const base::FilePath& temp_path) {
   std::vector<CrashReporter::UploadReportResult> uploaded_reports;
 
-  base::FilePath file_path = GetCrashesDirectory(product_name, temp_dir);
+  base::FilePath file_path = GetCrashesDirectory(product_name, temp_path);
   if (!base::PathExists(file_path)) {
     return uploaded_reports;
   }
index 644556c..c8f3491 100644 (file)
@@ -149,7 +149,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
                                     const std::string& version,
                                     const std::string& company_name,
                                     const std::string& submit_url,
-                                    const std::string& temp_dir,
+                                    const base::FilePath& temp_path,
                                     bool auto_submit,
                                     bool skip_system_crash_handler) {
   skip_system_crash_handler_ = skip_system_crash_handler;
@@ -172,7 +172,7 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
   breakpad_.reset();
 
   breakpad_.reset(new google_breakpad::ExceptionHandler(
-      temp_dir,
+      temp_path.value(),
       FilterCallback,
       MinidumpCallback,
       this,
index ec47cb7..1b9955f 100644 (file)
@@ -27,7 +27,7 @@ class CrashReporterWin : public CrashReporter {
                     const std::string& version,
                     const std::string& company_name,
                     const std::string& submit_url,
-                    const std::string& temp_dir,
+                    const base::FilePath& temp_path,
                     bool auto_submit,
                     bool skip_system_crash_handler) override;
   void SetUploadParameters() override;