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

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

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « mojo/edk/system/transport_data.cc ('k') | mojo/edk/system/unique_identifier.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/unique_identifier.h
diff --git a/mojo/edk/system/unique_identifier.h b/mojo/edk/system/unique_identifier.h
deleted file mode 100644
index a7f68bab222cbf24e51e73a869d21de330a05435..0000000000000000000000000000000000000000
--- a/mojo/edk/system/unique_identifier.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_EDK_SYSTEM_UNIQUE_IDENTIFIER_H_
-#define MOJO_EDK_SYSTEM_UNIQUE_IDENTIFIER_H_
-
-#include <stdint.h>
-#include <string.h>
-
-#include <iosfwd>
-
-#include "base/compiler_specific.h"
-#include "base/containers/hash_tables.h"
-#include "mojo/edk/system/system_impl_export.h"
-
-namespace mojo {
-namespace system {
-
-class UniqueIdentifier;
-
-} // namespace system
-} // namespace mojo
-
-namespace BASE_HASH_NAMESPACE {
-
-// Declare this before |UniqueIdentifier|, so that it can be friended.
-template <>
-struct hash<mojo::system::UniqueIdentifier>;
-
-} // BASE_HASH_NAMESPACE
-
-namespace mojo {
-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 {
- public:
- // This generates a new identifier. Uniqueness is "guaranteed" (i.e.,
- // probabilistically) for identifiers.
- static UniqueIdentifier Generate();
-
- bool operator==(const UniqueIdentifier& other) const {
- return memcmp(data_, other.data_, sizeof(data_)) == 0;
- }
- bool operator!=(const UniqueIdentifier& other) const {
- return !operator==(other);
- }
- bool operator<(const UniqueIdentifier& other) const {
- return memcmp(data_, other.data_, sizeof(data_)) < 0;
- }
-
- private:
- friend BASE_HASH_NAMESPACE::hash<mojo::system::UniqueIdentifier>;
- friend std::ostream& operator<<(std::ostream&, const UniqueIdentifier&);
-
- explicit UniqueIdentifier() {}
-
- char data_[16];
-
- // Copying and assignment allowed.
-};
-static_assert(sizeof(UniqueIdentifier) == 16,
- "UniqueIdentifier has wrong size.");
-// We want to be able to take any buffer and cast it to a |UniqueIdentifier|.
-static_assert(ALIGNOF(UniqueIdentifier) == 1,
- "UniqueIdentifier requires nontrivial alignment.");
-
-} // namespace system
-} // namespace mojo
-
-namespace BASE_HASH_NAMESPACE {
-
-template <>
-struct hash<mojo::system::UniqueIdentifier> {
- size_t operator()(mojo::system::UniqueIdentifier unique_identifier) const {
- return base::HashInts64(
- *reinterpret_cast<uint64_t*>(unique_identifier.data_),
- *reinterpret_cast<uint64_t*>(unique_identifier.data_ +
- sizeof(uint64_t)));
- }
-};
-
-} // BASE_HASH_NAMESPACE
-
-#endif // MOJO_EDK_SYSTEM_UNIQUE_IDENTIFIER_H_
« no previous file with comments | « mojo/edk/system/transport_data.cc ('k') | mojo/edk/system/unique_identifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698