diff options
Diffstat (limited to 'src/client/mac/crash_generation')
-rw-r--r-- | src/client/mac/crash_generation/crash_generation_server.cc | 6 | ||||
-rw-r--r-- | src/client/mac/crash_generation/crash_generation_server.h | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/client/mac/crash_generation/crash_generation_server.cc b/src/client/mac/crash_generation/crash_generation_server.cc index 44548ef0..b3eb403f 100644 --- a/src/client/mac/crash_generation/crash_generation_server.cc +++ b/src/client/mac/crash_generation/crash_generation_server.cc @@ -37,6 +37,8 @@ namespace google_breakpad { CrashGenerationServer::CrashGenerationServer( const char *mach_port_name, + FilterCallback filter, + void *filter_context, OnClientDumpRequestCallback dump_callback, void *dump_context, OnClientExitingCallback exit_callback, @@ -44,6 +46,8 @@ CrashGenerationServer::CrashGenerationServer( bool generate_dumps, const std::string &dump_path) : dump_callback_(dump_callback), + filter_(filter), + filter_context_(filter_context), dump_context_(dump_context), exit_callback_(exit_callback), exit_context_(exit_context), @@ -110,7 +114,7 @@ bool CrashGenerationServer::WaitForOneMessage() { bool result; std::string dump_path; - if (generate_dumps_) { + if (generate_dumps_ && (!filter_ || filter_(filter_context_))) { ScopedTaskSuspend suspend(remote_task); MinidumpGenerator generator(remote_task, handler_thread); diff --git a/src/client/mac/crash_generation/crash_generation_server.h b/src/client/mac/crash_generation/crash_generation_server.h index 6e6cb44d..85bd5b5e 100644 --- a/src/client/mac/crash_generation/crash_generation_server.h +++ b/src/client/mac/crash_generation/crash_generation_server.h @@ -65,10 +65,14 @@ class CrashGenerationServer { typedef void (*OnClientExitingCallback)(void *context, const ClientInfo &client_info); + // If a FilterCallback returns false, the dump will not be written. + typedef bool (*FilterCallback)(void *context); // Create an instance with the given parameters. // // mach_port_name: Named server port to listen on. + // filter: Callback for a client to cancel writing a dump. + // filter_context: Context for the filter callback. // dump_callback: Callback for a client crash dump request. // dump_context: Context for client crash dump request callback. // exit_callback: Callback for client process exit. @@ -80,6 +84,8 @@ class CrashGenerationServer { // dump_path: Path for generating dumps; required only if true is // passed for generateDumps parameter; NULL can be passed otherwise. CrashGenerationServer(const char *mach_port_name, + FilterCallback filter, + void *filter_context, OnClientDumpRequestCallback dump_callback, void *dump_context, OnClientExitingCallback exit_callback, @@ -109,6 +115,9 @@ class CrashGenerationServer { // if a quit message was received or if an error occurred. bool WaitForOneMessage(); + FilterCallback filter_; + void *filter_context_; + OnClientDumpRequestCallback dump_callback_; void *dump_context_; |