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

Unified Diff: util/misc/uuid.cc

Issue 999953002: Use LockFile/UnlockFile for Settings to port to Windows (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@lock-fileio-2
Patch Set: init 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
« client/settings_test.cc ('K') | « util/misc/uuid.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/misc/uuid.cc
diff --git a/util/misc/uuid.cc b/util/misc/uuid.cc
index 904efcd339838d7b8a9d0e2f456ccfc49d5ffe6e..4b8417ae6989edd9b1dd287f70bad4a829be378e 100644
--- a/util/misc/uuid.cc
+++ b/util/misc/uuid.cc
@@ -23,11 +23,16 @@
#include <string.h>
#include "base/basictypes.h"
+#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/sys_byteorder.h"
#include "util/stdlib/cxx.h"
+#if defined(OS_MACOSX)
+#include <uuid/uuid.h>
+#endif // OS_MACOSX
+
#if CXX_LIBRARY_VERSION >= 2011
#include <type_traits>
#endif
@@ -119,4 +124,22 @@ base::string16 UUID::ToString16() const {
}
#endif // OS_WIN
+// static
+bool UUID::GenerateFromSystem(UUID* into) {
+#if defined(OS_MACOSX)
+ uuid_t uuid;
+ uuid_generate(uuid);
+ into->InitializeFromBytes(uuid);
+ return true;
+#elif defined(OS_WIN)
+ ::UUID system_uuid;
+ if (UuidCreate(&system_uuid) != RPC_S_OK) {
+ LOG(ERROR) << "UuidCreate";
+ return false;
+ }
+ into->InitializeFromSystemUUID(&system_uuid);
+ return true;
+#endif // OS_MACOSX
Robert Sesek 2015/04/01 15:08:26 #else #error "This function needs to be ported" ?
scottmg 2015/04/01 19:32:11 I figured it just wouldn't compile, but sure.
+}
+
} // namespace crashpad
« client/settings_test.cc ('K') | « util/misc/uuid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698