Chromium Code Reviews| Index: components/crash/content/app/crashpad_mac.mm |
| diff --git a/components/crash/content/app/crashpad_mac.mm b/components/crash/content/app/crashpad_mac.mm |
| index 7df66ea3d3244c5ff2625d860353e78625024412..acb5b8ab3d8e2a276caa73c4356e6006fb618224 100644 |
| --- a/components/crash/content/app/crashpad_mac.mm |
| +++ b/components/crash/content/app/crashpad_mac.mm |
| @@ -13,6 +13,7 @@ |
| #include <vector> |
| #include "base/files/file_path.h" |
| +#include "base/lazy_instance.h" |
| #include "base/logging.h" |
| #include "base/mac/bundle_locations.h" |
| #include "base/mac/foundation_util.h" |
| @@ -29,6 +30,18 @@ |
| #include "third_party/crashpad/crashpad/client/simulate_crash.h" |
| namespace crash_reporter { |
| + |
| +namespace { |
| + |
| +base::LazyInstance<crashpad::CrashpadClient>::Leaky g_crashpad_client = |
| + LAZY_INSTANCE_INITIALIZER; |
|
Robert Sesek
2017/03/14 22:14:54
Also worth noting that this is how crashpad_win.cc
Mark Mentovai
2017/03/14 23:24:52
Robert Sesek wrote:
Robert Sesek
2017/03/15 19:22:10
Done. (Assuming you really did want a non-const-re
|
| + |
| +} // namespace |
| + |
| +base::mac::ScopedMachSendRight GetHandlerMachPort() { |
| + return g_crashpad_client.Get().GetHandlerMachPort(); |
| +} |
| + |
| namespace internal { |
| base::FilePath PlatformCrashpadInitialization(bool initial_client, |
| @@ -90,15 +103,9 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, |
| "--reset-own-crash-exception-port-to-system-default"); |
| } |
| - crashpad::CrashpadClient crashpad_client; |
| - bool result = crashpad_client.StartHandler(handler_path, |
| - database_path, |
| - metrics_path, |
| - url, |
| - process_annotations, |
| - arguments, |
| - true, |
| - false); |
| + bool result = g_crashpad_client.Get().StartHandler( |
|
Mark Mentovai
2017/03/14 23:24:52
clang-format’s worse, and I guess I’m not supposed
Robert Sesek
2017/03/15 19:22:10
https://bugs.chromium.org/p/chromium/issues/detail
|
| + handler_path, database_path, metrics_path, url, process_annotations, |
| + arguments, true, false); |
| // If this is an initial client that's not the browser process, it's |
| // important to sever the connection to any existing handler. If |