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

Unified Diff: handler/mac/crash_report_upload_thread.cc

Issue 998033002: Carry the client ID from the database all the way through upload (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « handler/mac/crash_report_exception_handler.cc ('k') | minidump/minidump_crashpad_info_writer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: handler/mac/crash_report_upload_thread.cc
diff --git a/handler/mac/crash_report_upload_thread.cc b/handler/mac/crash_report_upload_thread.cc
index 17c5a8bea3c7fdcd62acce04f8066e20058e7c5c..0e77ee730a0d585338830b7ba80a33e7a52b905f 100644
--- a/handler/mac/crash_report_upload_thread.cc
+++ b/handler/mac/crash_report_upload_thread.cc
@@ -27,6 +27,7 @@
#include "snapshot/minidump/process_snapshot_minidump.h"
#include "snapshot/module_snapshot.h"
#include "util/file/file_reader.h"
+#include "util/misc/uuid.h"
#include "util/net/http_body.h"
#include "util/net/http_multipart_builder.h"
#include "util/net/http_transport.h"
@@ -35,6 +36,19 @@ namespace crashpad {
namespace {
+void InsertOrReplaceMapEntry(std::map<std::string, std::string>* map,
+ const std::string& key,
+ const std::string& value) {
+ auto it = map->find(key);
+ if (it != map->end()) {
+ LOG(WARNING) << "duplicate key " << key << ", discarding value "
+ << it->second;
+ it->second = value;
+ } else {
+ map->insert(std::make_pair(key, value));
+ }
+}
+
// Given a minidump file readable by |minidump_file_reader|, returns a map of
// key-value pairs to use as HTTP form parameters for upload to a Breakpad
// server. The map is built by combining the process simple annotations map with
@@ -43,6 +57,8 @@ namespace {
// discarded values. Each module’s annotations vector is also examined and built
// into a single string value, with distinct elements separated by newlines, and
// stored at the key named “list_annotations”, which supersedes any other key
+// found by that name. The client ID stored in the minidump is converted to
+// a string and stored at the key named “guid”, which supersedes any other key
// found by that name.
//
// In the event of an error reading the minidump file, a message will be logged.
@@ -77,17 +93,13 @@ std::map<std::string, std::string> BreakpadHTTPFormParametersFromMinidump(
// Remove the final newline character.
list_annotations.resize(list_annotations.size() - 1);
- const char kListAnnotationsKey[] = "list_annotations";
- auto it = parameters.find(kListAnnotationsKey);
- if (it != parameters.end()) {
- LOG(WARNING) << "duplicate key " << kListAnnotationsKey
- << ", discarding value " << it->second;
- it->second = list_annotations;
- } else {
- parameters.insert(std::make_pair(kListAnnotationsKey, list_annotations));
- }
+ InsertOrReplaceMapEntry(&parameters, "list_annotations", list_annotations);
}
+ UUID client_id;
+ minidump_process_snapshot.ClientID(&client_id);
+ InsertOrReplaceMapEntry(&parameters, "guid", client_id.ToString());
+
return parameters;
}
« no previous file with comments | « handler/mac/crash_report_exception_handler.cc ('k') | minidump/minidump_crashpad_info_writer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698