Chromium Code Reviews| 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 |