Index: third_party/mojo/src/mojo/edk/system/unique_identifier.h |
diff --git a/third_party/mojo/src/mojo/edk/system/unique_identifier.h b/third_party/mojo/src/mojo/edk/system/unique_identifier.h |
index c9cba8836b4c5bbb1cab82a43c99ec1305e419ea..1a13b361bc90cb1475b6355fad5d7c5bc727e67e 100644 |
--- a/third_party/mojo/src/mojo/edk/system/unique_identifier.h |
+++ b/third_party/mojo/src/mojo/edk/system/unique_identifier.h |
@@ -8,7 +8,7 @@ |
#include <stdint.h> |
#include <string.h> |
-#include <iosfwd> |
+#include <string> |
#include "base/compiler_specific.h" |
#include "base/containers/hash_tables.h" |
@@ -40,11 +40,6 @@ class PlatformSupport; |
namespace system { |
-// Declare this before |UniqueIdentifier|, so that it can be friended. |
-MOJO_SYSTEM_IMPL_EXPORT std::ostream& operator<<( |
- std::ostream& out, |
- const UniqueIdentifier& unique_identifier); |
- |
// |UniqueIdentifier| is a POD class whose value is used to uniquely identify |
// things. |
class MOJO_SYSTEM_IMPL_EXPORT UniqueIdentifier { |
@@ -53,6 +48,17 @@ class MOJO_SYSTEM_IMPL_EXPORT UniqueIdentifier { |
// probabilistically) for identifiers. |
static UniqueIdentifier Generate(embedder::PlatformSupport* platform_support); |
+ // This reconstitutes an identifier from its representation as a string |
+ // (generated by |ToString()|, below). On success, |*success| is set to true; |
+ // on failure, it is set to false (and the return value is undefined). |
+ static UniqueIdentifier FromString(const std::string& s, bool* success); |
+ |
+ // Yields a string representation of this identifier (which can be |
+ // reconstituted using |FromString()|. The result will consist of printable, |
+ // non-whitespace ASCII characters. It will *not* contain the following |
+ // characters: ", ', or \. |
+ std::string ToString() const; |
+ |
bool operator==(const UniqueIdentifier& other) const { |
return memcmp(data_, other.data_, sizeof(data_)) == 0; |
} |
@@ -65,9 +71,6 @@ class MOJO_SYSTEM_IMPL_EXPORT UniqueIdentifier { |
private: |
friend BASE_HASH_NAMESPACE::hash<mojo::system::UniqueIdentifier>; |
- friend MOJO_SYSTEM_IMPL_EXPORT std::ostream& operator<<( |
- std::ostream&, |
- const UniqueIdentifier&); |
explicit UniqueIdentifier() {} |