Index: components/crash/content/app/run_as_crashpad_handler_win.cc |
diff --git a/components/crash/content/app/run_as_crashpad_handler_win.cc b/components/crash/content/app/run_as_crashpad_handler_win.cc |
index 6ea93489f1f89d2f7080e8bf0dfcdfb77e6a73f2..a7cf442b0e60d174488f3e04e384b58187097a11 100644 |
--- a/components/crash/content/app/run_as_crashpad_handler_win.cc |
+++ b/components/crash/content/app/run_as_crashpad_handler_win.cc |
@@ -10,18 +10,22 @@ |
#include <vector> |
#include "base/command_line.h" |
+#include "base/memory/ptr_util.h" |
#include "base/process/memory.h" |
-#include "base/strings/string16.h" |
#include "base/strings/string_util.h" |
#include "base/strings/utf_string_conversions.h" |
+#include "components/browser_watcher/stability_report_user_stream_data_source.h" |
#include "third_party/crashpad/crashpad/client/crashpad_info.h" |
#include "third_party/crashpad/crashpad/client/simple_string_dictionary.h" |
#include "third_party/crashpad/crashpad/handler/handler_main.h" |
+#include "third_party/crashpad/crashpad/handler/user_stream_data_source.h" |
namespace crash_reporter { |
int RunAsCrashpadHandler(const base::CommandLine& command_line, |
- const char* process_type_switch) { |
+ const base::FilePath& user_data_dir, |
+ const char* process_type_switch, |
+ const char* user_data_dir_switch) { |
// Make sure this process terminates on OOM in the same mode as other Chrome |
// processes. |
base::EnableTerminationOnOutOfMemory(); |
@@ -46,11 +50,16 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line, |
std::vector<base::string16> argv = command_line.argv(); |
const base::string16 process_type_arg_prefix = |
base::string16(L"--") + base::UTF8ToUTF16(process_type_switch) + L"="; |
+ const base::string16 user_data_dir_arg_prefix = |
+ base::string16(L"--") + base::UTF8ToUTF16(user_data_dir_switch) + L"="; |
argv.erase( |
std::remove_if(argv.begin(), argv.end(), |
- [&process_type_arg_prefix](const base::string16& str) { |
+ [&process_type_arg_prefix, |
+ &user_data_dir_arg_prefix](const base::string16& str) { |
return base::StartsWith(str, process_type_arg_prefix, |
base::CompareCase::SENSITIVE) || |
+ base::StartsWith(str, user_data_dir_arg_prefix, |
+ base::CompareCase::SENSITIVE) || |
(!str.empty() && str[0] == L'/'); |
}), |
argv.end()); |
@@ -64,8 +73,20 @@ int RunAsCrashpadHandler(const base::CommandLine& command_line, |
} |
argv_as_utf8[argv.size()] = nullptr; |
argv.clear(); |
+ |
+ crashpad::UserStreamDataSources user_stream_data_sources; |
+ // Interpret an empty user data directory as a missing value. |
+ if (!user_data_dir.empty()) { |
+ // Register an extension to collect stability information. The extension |
+ // will be invoked for any registered process' crashes, but information only |
+ // exists for instrumented browser processes. |
+ user_stream_data_sources.push_back( |
+ base::MakeUnique<browser_watcher::StabilityReportUserStreamDataSource>( |
+ user_data_dir)); |
+ } |
+ |
return crashpad::HandlerMain(static_cast<int>(storage.size()), |
- argv_as_utf8.get(), nullptr); |
+ argv_as_utf8.get(), &user_stream_data_sources); |
} |
} // namespace crash_reporter |