DRY up temp directory logging

This commit is contained in:
Kevin Sawicki 2016-10-05 14:00:27 -07:00
parent 1afe501a36
commit 81733a523e
4 changed files with 8 additions and 11 deletions

View file

@ -36,7 +36,10 @@ void CrashReporter::Start(const std::string& product_name,
}
bool CrashReporter::GetTempDirectory(base::FilePath* path) {
return PathService::Get(base::DIR_TEMP, path);
bool success = PathService::Get(base::DIR_TEMP, path);
if (!success)
LOG(ERROR) << "Cannot get temp directory";
return success;
}
bool CrashReporter::GetCrashesDirectory(

View file

@ -79,10 +79,8 @@ void CrashReporterLinux::SetUploadParameters() {
void CrashReporterLinux::EnableCrashDumping(const std::string& product_name) {
base::FilePath dumps_path;
if (!GetCrashesDirectory(&dumps_path)) {
LOG(ERROR) << "Cannot get temp directory";
if (!GetCrashesDirectory(&dumps_path))
return;
}
base::CreateDirectory(dumps_path);

View file

@ -34,15 +34,13 @@ void CrashReporterMac::InitBreakpad(const std::string& product_name,
bool auto_submit,
bool skip_system_crash_handler) {
// check whether crashpad has been initialized.
// Only need to initilize once.
// Only need to initialize once.
if (simple_string_dictionary_)
return;
base::FilePath database_path;
if (!GetCrashesDirectory(product_name, &database_path)) {
LOG(ERROR) << "Cannot get temp directory";
if (!GetCrashesDirectory(product_name, &database_path))
return;
}
if (is_browser_) {
@autoreleasepool {

View file

@ -154,10 +154,8 @@ void CrashReporterWin::InitBreakpad(const std::string& product_name,
skip_system_crash_handler_ = skip_system_crash_handler;
base::FilePath temp_dir;
if (!GetTempDirectory(&temp_dir)) {
LOG(ERROR) << "Cannot get temp directory";
if (!GetTempDirectory(&temp_dir))
return;
}
base::string16 pipe_name = base::ReplaceStringPlaceholders(
kPipeNameFormat, base::UTF8ToUTF16(product_name), NULL);