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

Unified Diff: third_party/mojo/src/mojo/edk/system/unique_identifier.h

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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() {}

Powered by Google App Engine
This is Rietveld 408576698