Chromium Code Reviews| Index: chrome/app/chrome_crash_reporter_client.cc |
| diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client.cc |
| index 2663a08017ad0aef4a048deeffd8eb441465f9f1..643371244f21d52b38d2fdef067af80eddbe255f 100644 |
| --- a/chrome/app/chrome_crash_reporter_client.cc |
| +++ b/chrome/app/chrome_crash_reporter_client.cc |
| @@ -7,15 +7,18 @@ |
| #include "base/command_line.h" |
| #include "base/environment.h" |
| #include "base/files/file_path.h" |
| +#include "base/files/file_util.h" |
| #include "base/logging.h" |
| #include "base/path_service.h" |
| #include "base/strings/string_split.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "base/threading/thread_restrictions.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_result_codes.h" |
| #include "chrome/common/crash_keys.h" |
| #include "chrome/common/env_vars.h" |
| +#include "chrome/installer/util/browser_distribution.h" |
| #include "chrome/installer/util/google_update_settings.h" |
| #include "content/public/common/content_switches.h" |
| @@ -278,6 +281,26 @@ base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() { |
| bool ChromeCrashReporterClient::GetCrashDumpLocation( |
| base::FilePath* crash_dir) { |
| +#if defined(OS_WIN) |
| + // In order to be able to start crash handling very early, we do not rely on |
| + // the PathService being available on Windows. See http://crbug.com/564398. |
| + if (GetAlternativeCrashDumpLocation(crash_dir)) |
|
Mark Mentovai
2015/12/02 22:47:12
This slurps a path out of BREAKPAD_DUMP_LOCATION.
scottmg
2015/12/03 01:40:15
The only place I could find on Windows is https://
|
| + return true; |
| + base::FilePath result; |
| + if (!base::GetLocalAppData(&result)) |
| + return false; |
| + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| + result = result.Append(dist->GetInstallSubDir()); |
| + result = result.Append(chrome::kUserDataDirname); |
|
Mark Mentovai
2015/12/02 22:47:12
Need to manually look for --user-data-dir too?
scottmg
2015/12/03 01:40:15
This is copied from https://code.google.com/p/chro
|
| + result = result.Append(FILE_PATH_LITERAL("Crashpad")); |
| + |
| + // TODO(bauerb): http://crbug.com/259796 |
| + base::ThreadRestrictions::ScopedAllowIO allow_io; |
| + if (!base::PathExists(result) && !base::CreateDirectory(result)) |
|
Mark Mentovai
2015/12/02 22:47:12
The Crashpad handler doesn’t care if you start it
scottmg
2015/12/03 01:40:15
Done.
|
| + return false; |
| + *crash_dir = result; |
| + return true; |
| +#else |
| // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate |
| // location to write breakpad crash dumps can be set. |
| scoped_ptr<base::Environment> env(base::Environment::Create()); |
| @@ -289,6 +312,7 @@ bool ChromeCrashReporterClient::GetCrashDumpLocation( |
| } |
| return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); |
| +#endif |
| } |
| size_t ChromeCrashReporterClient::RegisterCrashKeys() { |