Chromium Code Reviews| Index: client/mac/Framework/Breakpad.mm |
| diff --git a/client/mac/Framework/Breakpad.mm b/client/mac/Framework/Breakpad.mm |
| index fe592bf39f071157985daf2a4a0bcb28cba0d879..3f0b2dec8e7f795797208b8a608cde831445e1fc 100644 |
| --- a/client/mac/Framework/Breakpad.mm |
| +++ b/client/mac/Framework/Breakpad.mm |
| @@ -173,6 +173,8 @@ class Breakpad { |
| } |
| bool Initialize(NSDictionary *parameters); |
| + bool InitializeInProcess(NSDictionary *parameters); |
| + bool InitializeOutOfProcess(NSDictionary *parameters); |
| bool ExtractParameters(NSDictionary *parameters); |
| @@ -188,6 +190,14 @@ class Breakpad { |
| int exception_subcode, |
| mach_port_t crashing_thread); |
| + // Dispatches to HandleMinidump() |
| + static bool HandleMinidumpCallback(const char *dump_dir, |
| + const char *minidump_id, |
| + void *context, bool succeeded); |
| + |
| + bool HandleMinidump(const char *dump_dir, |
| + const char *minidump_id); |
| + |
| // Since ExceptionHandler (w/o namespace) is defined as typedef in OSX's |
| // MachineExceptions.h, we have to explicitly name the handler. |
| google_breakpad::ExceptionHandler *handler_; // The actual handler (STRONG) |
| @@ -266,6 +276,20 @@ bool Breakpad::ExceptionHandlerDirectCallback(void *context, |
| } |
| //============================================================================= |
| +bool Breakpad::HandleMinidumpCallback(const char *dump_dir, |
| + const char *minidump_id, |
| + void *context, bool succeeded) { |
| + Breakpad *breakpad = (Breakpad *)context; |
| + |
| + // If our context is damaged or something, just return false to indicate that |
| + // the handler should continue without us. |
| + if (!breakpad || !succeeded) |
| + return false; |
| + |
| + return breakpad->HandleMinidump(dump_dir, minidump_id); |
| +} |
| + |
| +//============================================================================= |
| #pragma mark - |
| #include <dlfcn.h> |
| @@ -326,6 +350,25 @@ bool Breakpad::Initialize(NSDictionary *parameters) { |
| return false; |
| } |
| + if ([[parameters objectForKey:@BREAKPAD_IN_PROCESS] boolValue]) |
| + return InitializeInProcess(parameters); |
| + else |
| + return InitializeOutOfProcess(parameters); |
| +} |
| + |
| +//============================================================================= |
| +bool Breakpad::InitializeInProcess(NSDictionary* parameters) { |
| + handler_ = |
| + new (gBreakpadAllocator->Allocate( |
| + sizeof(google_breakpad::ExceptionHandler))) |
| + google_breakpad::ExceptionHandler( |
| + config_params_->GetValueForKey(BREAKPAD_DUMP_DIRECTORY), |
| + 0, &HandleMinidumpCallback, this, true, 0); |
| + return true; |
| +} |
| + |
| +//============================================================================= |
| +bool Breakpad::InitializeOutOfProcess(NSDictionary* parameters) { |
| // Get path to Inspector executable. |
| NSString *inspectorPathString = KeyValue(@BREAKPAD_INSPECTOR_LOCATION); |
| @@ -711,6 +754,17 @@ bool Breakpad::HandleException(int exception_type, |
| } |
| //============================================================================= |
| +bool Breakpad::HandleMinidump(const char *dump_dir, |
| + const char *minidump_id) { |
| + // google_breakpad::ConfigFile config_file; |
| + // config_file.WriteFile(dump_dir, config_params_, dump_dir, minidump_id); |
| + // google_breakpad::Inspector::LaunchReporter( |
| + // config_params_->GetValueForKey(BREAKPAD_REPORTER_EXE_LOCATION), |
| + // config_file.GetFilePath()); |
|
Andre
2014/09/12 18:04:59
This was my first naive attempt, but it didn't lin
Andre
2014/09/12 18:22:00
I'm considering promoting ConfigFile and LaunchRep
|
| + return true; |
| +} |
| + |
| +//============================================================================= |
| //============================================================================= |
| #pragma mark - |