FIXME: allow IO access on main thread for crash reporter
This commit is contained in:
parent
abe1faea5c
commit
237bd6790b
2 changed files with 5 additions and 28 deletions
|
@ -17,7 +17,7 @@
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/memory/singleton.h"
|
#include "base/memory/singleton.h"
|
||||||
#include "base/process/memory.h"
|
#include "base/process/memory.h"
|
||||||
#include "base/task_scheduler/post_task.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "vendor/breakpad/src/client/linux/handler/exception_handler.h"
|
#include "vendor/breakpad/src/client/linux/handler/exception_handler.h"
|
||||||
#include "vendor/breakpad/src/common/linux/linux_libc_support.h"
|
#include "vendor/breakpad/src/common/linux/linux_libc_support.h"
|
||||||
|
|
||||||
|
@ -35,18 +35,6 @@ static const size_t kDistroSize = 128;
|
||||||
// no limit.
|
// no limit.
|
||||||
static const off_t kMaxMinidumpFileSize = 1258291;
|
static const off_t kMaxMinidumpFileSize = 1258291;
|
||||||
|
|
||||||
bool CreateCrashDataDirectory(const base::FilePath& crashes_dir) {
|
|
||||||
// Make sure the crash log directory is created.
|
|
||||||
bool success = base::CreateDirectoryAndGetError(crashes_dir, nullptr);
|
|
||||||
|
|
||||||
if (!success) {
|
|
||||||
NOTREACHED() << "Failed to create directory '" << crashes_dir.value()
|
|
||||||
<< "'";
|
|
||||||
}
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CrashReporterLinux::CrashReporterLinux()
|
CrashReporterLinux::CrashReporterLinux()
|
||||||
|
@ -103,19 +91,10 @@ bool CrashReporterLinux::GetUploadToServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrashReporterLinux::EnableCrashDumping(const base::FilePath& crashes_dir) {
|
void CrashReporterLinux::EnableCrashDumping(const base::FilePath& crashes_dir) {
|
||||||
base::PostTaskWithTraitsAndReplyWithResult(
|
{
|
||||||
FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND},
|
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||||
base::Bind(&CreateCrashDataDirectory, crashes_dir),
|
base::CreateDirectory(crashes_dir);
|
||||||
base::Bind(&CrashReporterLinux::OnCrashDataDirectoryCreated,
|
}
|
||||||
base::Unretained(this), crashes_dir));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CrashReporterLinux::OnCrashDataDirectoryCreated(
|
|
||||||
const base::FilePath& crashes_dir,
|
|
||||||
bool success) {
|
|
||||||
if (!success)
|
|
||||||
return;
|
|
||||||
|
|
||||||
std::string log_file = crashes_dir.Append("uploads.log").value();
|
std::string log_file = crashes_dir.Append("uploads.log").value();
|
||||||
strncpy(g_crash_log_path, log_file.c_str(), sizeof(g_crash_log_path));
|
strncpy(g_crash_log_path, log_file.c_str(), sizeof(g_crash_log_path));
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,6 @@ class CrashReporterLinux : public CrashReporter {
|
||||||
virtual ~CrashReporterLinux();
|
virtual ~CrashReporterLinux();
|
||||||
|
|
||||||
void EnableCrashDumping(const base::FilePath& crashes_dir);
|
void EnableCrashDumping(const base::FilePath& crashes_dir);
|
||||||
void OnCrashDataDirectoryCreated(const base::FilePath& crashes_dir,
|
|
||||||
bool success);
|
|
||||||
|
|
||||||
static bool CrashDone(const google_breakpad::MinidumpDescriptor& minidump,
|
static bool CrashDone(const google_breakpad::MinidumpDescriptor& minidump,
|
||||||
void* context,
|
void* context,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue