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

Unified Diff: third_party/crashpad/crashpad/util/misc/uuid.cc

Issue 2478633002: Update Crashpad to b47bf6c250c6b825dee1c5fbad9152c2c962e828 (Closed)
Patch Set: mac comment 2 Created 4 years, 1 month 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: third_party/crashpad/crashpad/util/misc/uuid.cc
diff --git a/third_party/crashpad/crashpad/util/misc/uuid.cc b/third_party/crashpad/crashpad/util/misc/uuid.cc
index 9ef55a6508cf8c77721f9eef6a8f0c998cf8d356..e4b4b31a16c2857ab0856740ca2c19ca387ff58a 100644
--- a/third_party/crashpad/crashpad/util/misc/uuid.cc
+++ b/third_party/crashpad/crashpad/util/misc/uuid.cc
@@ -23,6 +23,7 @@
#include <string.h>
#include "base/logging.h"
+#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/sys_byteorder.h"
@@ -110,6 +111,16 @@ bool UUID::InitializeWithNew() {
}
InitializeFromSystemUUID(&system_uuid);
return true;
+#elif defined(OS_LINUX) || defined(OS_ANDROID)
+ // Linux does not provide a UUID generator in a widely-available system
+ // library. uuid_generate() from libuuid is not available everywhere.
+ base::RandBytes(this, sizeof(*this));
+
+ // Set six bits per RFC 4122 §4.4 to identify this as a pseudo-random UUID.
+ data_3 = (4 << 12) | (data_3 & 0x0fff); // §4.1.3
+ data_4[0] = 0x80 | (data_4[0] & 0x3f); // §4.1.1
+
+ return true;
#else
#error Port.
#endif // OS_MACOSX

Powered by Google App Engine
This is Rietveld 408576698