Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: components/crash/content/app/run_as_crashpad_handler_win.cc

Issue 2867063002: Stability instrumentation Crashpad integration (Closed)
Patch Set: clang compile Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..9e5b05b4a6d6558ca94d1ebbf54a881248ef26c8 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,23 @@
#include <vector>
#include "base/command_line.h"
+#include "base/files/file_path.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 +51,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 +74,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

Powered by Google App Engine
This is Rietveld 408576698