| Index: third_party/crashpad/crashpad/handler/handler_main.cc
|
| diff --git a/third_party/crashpad/crashpad/handler/handler_main.cc b/third_party/crashpad/crashpad/handler/handler_main.cc
|
| index 641bf0f635b853922257cb1d182cf63d1719051d..e6d05e22b63969a6c1bddf84bdcaba9a36c60174 100644
|
| --- a/third_party/crashpad/crashpad/handler/handler_main.cc
|
| +++ b/third_party/crashpad/crashpad/handler/handler_main.cc
|
| @@ -61,6 +61,7 @@
|
| #include "base/mac/scoped_mach_port.h"
|
| #include "handler/mac/crash_report_exception_handler.h"
|
| #include "handler/mac/exception_handler_server.h"
|
| +#include "handler/mac/file_limit_annotation.h"
|
| #include "util/mach/child_port_handshake.h"
|
| #include "util/mach/mach_extensions.h"
|
| #include "util/posix/close_stdio.h"
|
| @@ -109,6 +110,7 @@ void Usage(const base::FilePath& me) {
|
| " set a module annotation in the handler\n"
|
| " --monitor-self-argument=ARGUMENT\n"
|
| " provide additional arguments to the second handler\n"
|
| +" --no-periodic-tasks don't scan for new reports or prune the database\n"
|
| " --no-rate-limit don't rate limit crash uploads\n"
|
| " --no-upload-gzip don't use gzip compression when uploading\n"
|
| #if defined(OS_WIN)
|
| @@ -142,6 +144,7 @@ struct Options {
|
| InitialClientData initial_client_data;
|
| #endif // OS_MACOSX
|
| bool monitor_self;
|
| + bool periodic_tasks;
|
| bool rate_limit;
|
| bool upload_gzip;
|
| };
|
| @@ -353,6 +356,7 @@ void MonitorSelf(const Options& options) {
|
| return;
|
| }
|
| std::vector<std::string> extra_arguments(options.monitor_self_arguments);
|
| + extra_arguments.push_back("--no-periodic-tasks");
|
| if (!options.rate_limit) {
|
| extra_arguments.push_back("--no-rate-limit");
|
| }
|
| @@ -416,6 +420,7 @@ int HandlerMain(int argc,
|
| kOptionMonitorSelf,
|
| kOptionMonitorSelfAnnotation,
|
| kOptionMonitorSelfArgument,
|
| + kOptionNoPeriodicTasks,
|
| kOptionNoRateLimit,
|
| kOptionNoUploadGzip,
|
| #if defined(OS_WIN)
|
| @@ -456,6 +461,7 @@ int HandlerMain(int argc,
|
| required_argument,
|
| nullptr,
|
| kOptionMonitorSelfArgument},
|
| + {"no-periodic-tasks", no_argument, nullptr, kOptionNoPeriodicTasks},
|
| {"no-rate-limit", no_argument, nullptr, kOptionNoRateLimit},
|
| {"no-upload-gzip", no_argument, nullptr, kOptionNoUploadGzip},
|
| #if defined(OS_WIN)
|
| @@ -477,6 +483,7 @@ int HandlerMain(int argc,
|
| #if defined(OS_MACOSX)
|
| options.handshake_fd = -1;
|
| #endif
|
| + options.periodic_tasks = true;
|
| options.rate_limit = true;
|
| options.upload_gzip = true;
|
|
|
| @@ -540,6 +547,10 @@ int HandlerMain(int argc,
|
| options.monitor_self_arguments.push_back(optarg);
|
| break;
|
| }
|
| + case kOptionNoPeriodicTasks: {
|
| + options.periodic_tasks = false;
|
| + break;
|
| + }
|
| case kOptionNoRateLimit: {
|
| options.rate_limit = false;
|
| break;
|
| @@ -687,6 +698,8 @@ int HandlerMain(int argc,
|
| reset_sigterm.reset(&old_sigterm_action);
|
| }
|
| }
|
| +
|
| + RecordFileLimitAnnotation();
|
| #elif defined(OS_WIN)
|
| // Shut down as late as possible relative to programs we're watching.
|
| if (!SetProcessShutdownParameters(0x100, SHUTDOWN_NORETRY))
|
| @@ -721,13 +734,19 @@ int HandlerMain(int argc,
|
| // TODO(scottmg): options.rate_limit should be removed when we have a
|
| // configurable database setting to control upload limiting.
|
| // See https://crashpad.chromium.org/bug/23.
|
| - CrashReportUploadThread upload_thread(
|
| - database.get(), options.url, options.rate_limit, options.upload_gzip);
|
| + CrashReportUploadThread upload_thread(database.get(),
|
| + options.url,
|
| + options.periodic_tasks,
|
| + options.rate_limit,
|
| + options.upload_gzip);
|
| upload_thread.Start();
|
|
|
| - PruneCrashReportThread prune_thread(database.get(),
|
| - PruneCondition::GetDefault());
|
| - prune_thread.Start();
|
| + std::unique_ptr<PruneCrashReportThread> prune_thread;
|
| + if (options.periodic_tasks) {
|
| + prune_thread.reset(new PruneCrashReportThread(
|
| + database.get(), PruneCondition::GetDefault()));
|
| + prune_thread->Start();
|
| + }
|
|
|
| CrashReportExceptionHandler exception_handler(database.get(),
|
| &upload_thread,
|
| @@ -744,7 +763,9 @@ int HandlerMain(int argc,
|
| exception_handler_server.Run(&exception_handler);
|
|
|
| upload_thread.Stop();
|
| - prune_thread.Stop();
|
| + if (prune_thread) {
|
| + prune_thread->Stop();
|
| + }
|
|
|
| return EXIT_SUCCESS;
|
| }
|
|
|